Package org.jboss.jandex

Examples of org.jboss.jandex.MethodInfo


    private void processAroundInvoke(final AnnotationTarget target, final EEModuleDescription eeModuleDescription) {
        if (!(target instanceof MethodInfo)) {
            throw MESSAGES.annotationApplicableOnlyForMethods(AROUND_TIMEOUT_ANNOTATION_NAME.toString());
        }
        final MethodInfo methodInfo = MethodInfo.class.cast(target);
        final ClassInfo classInfo = methodInfo.declaringClass();
        final EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());

        validateArgumentType(classInfo, methodInfo);
        final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder(classDescription.getInterceptorClassDescription());
        builder.setAroundTimeout(MethodIdentifier.getIdentifier(Object.class, methodInfo.name(), InvocationContext.class));
        classDescription.setInterceptorClassDescription(builder.build());
    }
View Full Code Here


    List<AnnotationInstance> annotationInstances = annotations.get( callbackTypeName );
    if ( annotationInstances == null ) {
      return;
    }
    for ( AnnotationInstance callbackAnnotation : annotationInstances ) {
      MethodInfo methodInfo = (MethodInfo) callbackAnnotation.target();
      validateMethod( methodInfo, callbackTypeClass, callbacksByClass, isListener );
      callbacksByClass.put( callbackTypeClass, methodInfo.name() );
    }
  }
View Full Code Here

  private void createDefaultCallback(Class callbackTypeClass,
                     DotName callbackTypeName,
                     String callbackClassName,
                     Map<Class<?>, String> callbacksByClass) {
    for ( AnnotationInstance callback : getLocalBindingContext().getIndex().getAnnotations( callbackTypeName ) ) {
      MethodInfo methodInfo = (MethodInfo) callback.target();
      validateMethod( methodInfo, callbackTypeClass, callbacksByClass, true );
      if ( methodInfo.declaringClass().name().toString().equals( callbackClassName ) ) {
        if ( methodInfo.args().length != 1 ) {
          throw new PersistenceException(
              String.format(
                  "Callback method %s must have exactly one argument defined as either Object or %s in ",
                  methodInfo.name(),
                  getEntityName()
              )
          );
        }
        callbacksByClass.put( callbackTypeClass, methodInfo.name() );
      }
    }
  }
View Full Code Here

    private void processLifeCycle(final EEModuleDescription eeModuleDescription, final AnnotationTarget target, final DotName annotationType, final EEApplicationClasses applicationClasses) {
        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 = applicationClasses.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

                FieldInfo fieldInfo = (FieldInfo) annotationTarget;
                ClassInfo classInfo = fieldInfo.declaringClass();
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
                processFieldResource(phaseContext, fieldInfo, name, type, classDescription, annotation, eeModuleDescription, module);
            } else if (annotationTarget instanceof MethodInfo) {
                MethodInfo methodInfo = (MethodInfo) annotationTarget;
                ClassInfo classInfo = methodInfo.declaringClass();
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
                processMethodResource(phaseContext, methodInfo, name, type, classDescription, annotation, eeModuleDescription, module);
            } else if (annotationTarget instanceof ClassInfo) {
                ClassInfo classInfo = (ClassInfo) annotationTarget;
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
View Full Code Here

    }

    private void processExcludeClass(final EEModuleDescription eeModuleDescription, final AnnotationInstance annotation, final CompositeIndex index) throws DeploymentUnitProcessingException {
        final AnnotationTarget target = annotation.target();
        if (target instanceof MethodInfo) {
            final MethodInfo methodInfo = MethodInfo.class.cast(target);
            final Collection<ComponentDescription> components = this.getApplicableComponents(index, methodInfo.declaringClass(), eeModuleDescription);
            for (ComponentDescription component : components) {
                component.excludeClassInterceptors(methodIdentifierFromMethodInfo(methodInfo));
            }
        } else {
            throw new DeploymentUnitProcessingException("@ExcludeDefaultInterceptors annotation is only allowed on methods");
View Full Code Here

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

        validateArgumentType(classInfo, methodInfo);
        classDescription.setAroundInvokeMethod(MethodIdentifier.getIdentifier(Object.class, methodInfo.name(), InvocationContext.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 static void collectAndCacheMethodAnnotations(Index annotationIndex, ClassLoader classLoader,
         DotName annotationType, Map<String, List<CachedMethod>> targetCache) {
      for (AnnotationInstance ai : annotationIndex.getAnnotations(annotationType)) {
         if (ai.target() instanceof MethodInfo) {
            MethodInfo methodInfo = (MethodInfo) ai.target();
            ClassInfo classInfo = methodInfo.declaringClass();
            String clazz = classInfo.name().toString();
            List<CachedMethod> methodList = targetCache.get(clazz);
            if (methodList == null) {
               methodList = new LinkedList<CachedMethod>();
               targetCache.put(clazz, methodList);
View Full Code Here

                FieldInfo fieldInfo = (FieldInfo) annotationTarget;
                ClassInfo classInfo = fieldInfo.declaringClass();
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
                processFieldResource(phaseContext, fieldInfo, name, type, classDescription, annotation, eeModuleDescription, module, applicationClasses);
            } else if (annotationTarget instanceof MethodInfo) {
                MethodInfo methodInfo = (MethodInfo) annotationTarget;
                ClassInfo classInfo = methodInfo.declaringClass();
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
                processMethodResource(phaseContext, methodInfo, name, type, classDescription, annotation, eeModuleDescription, module, applicationClasses);
            } else if (annotationTarget instanceof ClassInfo) {
                ClassInfo classInfo = (ClassInfo) annotationTarget;
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
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.