Package org.jboss.jandex

Examples of org.jboss.jandex.MethodInfo


        if (annotations.size() > 1)
            throw new DeploymentUnitProcessingException("EJB 3.1 FR 4.9.4: at most one session synchronization method is allowed for " + annotationName);

        // session synchronization annotations can only be encountered on a method, so this cast is safe.
        final MethodInfo method = (MethodInfo) annotations.get(0).target();
        methodProcessor.process(method);
    }
View Full Code Here


                // Style 1
                final String className = target.toString();
                componentDescription.setTransactionAttribute(methodIntf, methodIntf == null ? className : null, transactionAttributeType);
            } else if (target instanceof MethodInfo) {
                // Style 3
                final MethodInfo method = (MethodInfo) target;
                final String className = method.declaringClass().toString();
                componentDescription.setTransactionAttribute(methodIntf, transactionAttributeType, className, method.name(), toString(method.args()));
            }
        }
    }
View Full Code Here

            for (final AnnotationInstance denyAllAnnotation : denyAllAnnotations) {
                final AnnotationTarget target = denyAllAnnotation.target();
                if (target instanceof ClassInfo) {
                    componentDescription.applyDenyAllOnAllViewsForClass(((ClassInfo) target).name().toString());
                } else if (target instanceof MethodInfo) {
                    final MethodInfo methodInfo = (MethodInfo) target;
                    final EJBMethodIdentifier ejbMethodIdentifier = EJBMethodIdentifier.fromMethodInfo(methodInfo);
                    componentDescription.applyDenyAllOnAllViewsForMethod(ejbMethodIdentifier);
                }
            }
            // move to super class
View Full Code Here

                // bean level
                componentDescription.setBeanLevelLockType(((ClassInfo) target).name().toString(), lockType);
                logger.debug("Bean " + componentDescription.getEJBName() + " marked for lock type " + lockType);
            } else if (target instanceof MethodInfo) {
                // method specific lock type
                final MethodInfo method = (MethodInfo) target;
                final MethodInfo methodInfo = (MethodInfo) target;
                final String[] argTypes = new String[methodInfo.args().length];
                int i = 0;
                for (Type argType : methodInfo.args()) {
                    argTypes[i++] = argType.name().toString();
                }
                MethodIdentifier identifier = MethodIdentifier.getIdentifier(methodInfo.returnType().name().toString(), methodInfo.name(), argTypes);
                componentDescription.setLockType(lockType, identifier);
            }
        }
    }
View Full Code Here

        List<AnnotationInstance> removeAnnotations = annotationsOnBean.get(REMOVE_ANNOTATION_DOT_NAME);
        if (removeAnnotations == null || removeAnnotations.isEmpty()) {
            return;
        }
        for (AnnotationInstance removeAnnotation : removeAnnotations) {
            final MethodInfo targetMethod = (MethodInfo) removeAnnotation.target();
            final MethodIdentifier removeMethod = MethodIdentifier.getIdentifier(targetMethod.returnType().toString(), targetMethod.name(), toString(targetMethod.args()));
            final AnnotationValue retainIfExceptionAnnValue = removeAnnotation.value("retainIfException");
            boolean retainIfException = false;
            if (retainIfExceptionAnnValue != null) {
                retainIfException = retainIfExceptionAnnValue.asBoolean();
            }
View Full Code Here

        for (AnnotationInstance annotationInstance : annotations) {
            AnnotationTarget target = annotationInstance.target();
            if (target instanceof ClassInfo) {
                componentDescription.addAsynchronousView(ClassInfo.class.cast(target).name().toString());
            } else if (target instanceof MethodInfo) {
                final MethodInfo methodInfo = MethodInfo.class.cast(target);
                final String[] args = new String[methodInfo.args().length];
                for(int i = 0; i < methodInfo.args().length; i++) {
                    args[i] = methodInfo.args()[i].name().toString();
                }
                componentDescription.addAsynchronousMethod(MethodIdentifier.getIdentifier(methodInfo.returnType().name().toString(), methodInfo.name(), args));
            }
        }
    }
View Full Code Here

                // bean level
                componentDescription.setBeanLevelAccessTimeout(((ClassInfo) target).name().toString(), accessTimeout);
                logger.debug("Bean " + componentDescription.getEJBName() + " marked for access timeout: " + accessTimeout);
            } else if (target instanceof MethodInfo) {
                // method specific access timeout
                final MethodInfo methodInfo = (MethodInfo) target;
                final String[] argTypes = new String[methodInfo.args().length];
                int i = 0;
                for (Type argType : methodInfo.args()) {
                    argTypes[i++] = argType.name().toString();
                }
                MethodIdentifier identifier = MethodIdentifier.getIdentifier(methodInfo.returnType().name().toString(), methodInfo.name(), argTypes);
                componentDescription.setAccessTimeout(accessTimeout, identifier);
            }
        }
    }
View Full Code Here

            for (final AnnotationInstance permitAllAnnotation : permitAllAnnotations) {
                final AnnotationTarget target = permitAllAnnotation.target();
                if (target instanceof ClassInfo) {
                    componentDescription.applyPermitAllOnAllViewsForClass(((ClassInfo) target).name().toString());
                } else if (target instanceof MethodInfo) {
                    final MethodInfo methodInfo = (MethodInfo) target;
                    final EJBMethodIdentifier ejbMethodIdentifier = EJBMethodIdentifier.fromMethodInfo(methodInfo);
                    componentDescription.applyPermitAllOnAllViewsForMethod(ejbMethodIdentifier);
                }
            }
            // move to super class
View Full Code Here

                FieldInfo fieldInfo = (FieldInfo) annotationTarget;
                declaringClass = fieldInfo.declaringClass();
                EEModuleClassDescription eeModuleClassDescription = applicationClasses.getOrAddClassByName(declaringClass.name().toString());
                this.processField(deploymentUnit, annotation, fieldInfo, eeModuleClassDescription);
            } else if (annotationTarget instanceof MethodInfo) {
                MethodInfo methodInfo = (MethodInfo) annotationTarget;
                declaringClass = methodInfo.declaringClass();
                EEModuleClassDescription eeModuleClassDescription = applicationClasses.getOrAddClassByName(declaringClass.name().toString());
                this.processMethod(deploymentUnit, annotation, methodInfo, eeModuleClassDescription);
            } else if (annotationTarget instanceof ClassInfo) {
                declaringClass = (ClassInfo) annotationTarget;
                EEModuleClassDescription eeModuleClassDescription = applicationClasses.getOrAddClassByName(declaringClass.name().toString());
View Full Code Here

    private void processLifeCycle(final EEModuleDescription eeModuleDescription, final AnnotationTarget target, final DotName annotationType) {
        if (!(target instanceof MethodInfo)) {
            throw new IllegalArgumentException(annotationType + " is only valid on method targets.");
        }
        final MethodInfo methodInfo = MethodInfo.class.cast(target);
        final ClassInfo classInfo = methodInfo.declaringClass();
        final EEModuleClassDescription classDescription = eeModuleDescription.getOrAddClassByName(classInfo.name().toString());

        final Type[] args = methodInfo.args();
        if (args.length > 1) {
            log.warn("Invalid number of arguments for method " + methodInfo.name() + " annotated with " + annotationType + " on class " + classInfo.name());
            return;
        } else if (args.length == 1 && !args[0].name().toString().equals(InvocationContext.class.getName())) {
            log.warn("Invalid signature for method " + methodInfo.name() + " annotated with " + annotationType + " on class " + classInfo.name() + ", signature must be void methodName(InvocationContext ctx)");
            return;
        }

        final MethodIdentifier methodIdentifier;
        if (args.length == 0) {
            methodIdentifier = MethodIdentifier.getIdentifier(Void.TYPE, methodInfo.name());
        } else {
            methodIdentifier = MethodIdentifier.getIdentifier(Void.TYPE, methodInfo.name(), InvocationContext.class);
        }
        if (annotationType == POST_CONSTRUCT_ANNOTATION) {
            classDescription.setPostConstructMethod(methodIdentifier);
        } else {
            classDescription.setPreDestroyMethod(methodIdentifier);
View Full Code Here

TOP

Related Classes of org.jboss.jandex.MethodInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.