Codota Logo
ClassInfo.annotations
Code IndexAdd Codota to your IDE (free)

How to use
annotations
method
in
org.jboss.jandex.ClassInfo

Best Java code snippets using org.jboss.jandex.ClassInfo.annotations (Showing top 20 results out of 315)

  • Common ways to obtain ClassInfo
private void myMethod () {
ClassInfo c =
  • Codota IconIndexer indexer;InputStream stream;indexer.index(stream)
  • Codota IconAnnotationInstance annotationInstance;(ClassInfo) annotationInstance.target()
  • Codota IconIndexView index;DotName className;index.getClassByName(className)
  • Smart code suggestions by Codota
}
origin: wildfly/wildfly

private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnotationName) {
  List<AnnotationInstance> annotations = classInfo.annotations().get(requiredAnnotationName);
  if (annotations != null) {
    for (AnnotationInstance annotationInstance : annotations) {
      if (annotationInstance.target().equals(classInfo)) {
        return true;
      }
    }
  }
  return false;
}
origin: wildfly/wildfly

private SessionType determineSessionType(final String ejbClass, final CompositeIndex compositeIndex) {
  if(ejbClass == null) {
    return null;
  }
  final ClassInfo info = compositeIndex.getClassByName(DotName.createSimple(ejbClass));
  if (info == null) {
    return null;
  }
  if(info.annotations().get(STATEFUL_ANNOTATION) != null) {
    return SessionType.Stateful;
  } else if(info.annotations().get(STATELESS_ANNOTATION) != null) {
    return SessionType.Stateless;
  } else if(info.annotations().get(SINGLETON_ANNOTATION) != null) {
    return SessionType.Singleton;
  }
  return null;
}
origin: wildfly/wildfly

  @Override
  public AnnotationType apply(ClassInfo clazz) {
    return new AnnotationType(clazz.name(), clazz.annotations().containsKey(Indices.INHERITED_NAME));
  }
};
origin: wildfly/wildfly

private boolean hasBeanDefiningAnnotation(ClassInfo classInfo, Set<AnnotationType> beanDefiningAnnotations) {
  Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotations();
  for (AnnotationType beanDefiningAnnotation : beanDefiningAnnotations) {
    List<AnnotationInstance> annotations = annotationsMap.get(beanDefiningAnnotation.getName());
    if (annotations != null) {
      for (AnnotationInstance annotationInstance : annotations) {
        if (annotationInstance.target().equals(classInfo)) {
          return true;
        }
      }
    }
  }
  return false;
}
origin: wildfly/wildfly

private boolean hasInjectConstructor() {
  List<AnnotationInstance> annotationInstances = classInfo.annotations().get(DOT_NAME_INJECT);
  if (annotationInstances != null) {
    for (AnnotationInstance instance : annotationInstances) {
      AnnotationTarget target = instance.target();
      if (target instanceof MethodInfo) {
        MethodInfo methodInfo = (MethodInfo) target;
        if (methodInfo.name().equals(CONSTRUCTOR_METHOD_NAME)) {
          return true;
        }
      }
    }
  }
  return false;
}
origin: wildfly/wildfly

  @Override
  public Set<String> apply(DotName name) {
    ClassInfo annotationClassInfo = index.getClassByName(name);
    ImmutableSet.Builder<String> builder = ImmutableSet.builder();
    if (annotationClassInfo != null) {
      for (DotName annotationName : annotationClassInfo.annotations().keySet()) {
        builder.add(annotationName.toString());
      }
    } else {
      try {
         Class<?> annotationClass = moduleClassLoader.loadClass(name.toString());
         for (Annotation annotation : annotationClass.getDeclaredAnnotations()) {
           builder.add(annotation.annotationType().getName());
         }
      } catch (ClassNotFoundException e) {
        WeldLogger.DEPLOYMENT_LOGGER.unableToLoadAnnotation(name.toString());
      }
    }
    return builder.build();
  }
}
origin: wildfly/wildfly

private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) {
  // Type and members
  if (classInfo.annotations().containsKey(requiredAnnotationName)) {
    return true;
  }
  // Meta-annotations
  for (DotName annotation : classInfo.annotations().keySet()) {
    if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) {
      return true;
    }
  }
  // Superclass
  final DotName superName = classInfo.superName();
  if (superName != null && !OBJECT_NAME.equals(superName)) {
    final ClassInfo superClassInfo = index.getClassByName(superName);
    if (superClassInfo == null) {
      // we are accessing a class that is outside of the jandex index
      // fallback to using reflection
      return Reflections.containsAnnotation(loadClass(superName.toString()), requiredAnnotation);
    }
    if (containsAnnotation(superClassInfo, requiredAnnotationName, requiredAnnotation)) {
      return true;
    }
  }
  return false;
}
origin: wildfly/wildfly

private void processAroundInvoke(final EEModuleDescription eeModuleDescription, final AnnotationTarget target) throws DeploymentUnitProcessingException {
  if (!(target instanceof MethodInfo)) {
    throw EeLogger.ROOT_LOGGER.methodOnlyAnnotation(AROUND_INVOKE_ANNOTATION_NAME);
  }
  final MethodInfo methodInfo = MethodInfo.class.cast(target);
  final ClassInfo classInfo = methodInfo.declaringClass();
  final EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
  final List<AnnotationInstance> classAroundInvokes = classInfo.annotations().get(AROUND_INVOKE_ANNOTATION_NAME);
  if(classAroundInvokes.size() > 1) {
    throw EeLogger.ROOT_LOGGER.aroundInvokeAnnotationUsedTooManyTimes(classInfo.name(), classAroundInvokes.size());
  }
  validateArgumentType(classInfo, methodInfo);
  InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder(classDescription.getInterceptorClassDescription());
  builder.setAroundInvoke(MethodIdentifier.getIdentifier(Object.class, methodInfo.name(), InvocationContext.class));
  classDescription.setInterceptorClassDescription(builder.build());
}
origin: org.jboss.weld.se/weld-se

private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnotationName) {
  Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotations();
  List<AnnotationInstance> annotations = annotationsMap.get(requiredAnnotationName);
  if (annotations != null) {
    for (AnnotationInstance annotationInstance : annotations) {
      if (annotationInstance.target().equals(classInfo)) {
        return true;
      }
    }
  }
  return false;
}
origin: weld/core

private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnotationName) {
  Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotations();
  List<AnnotationInstance> annotations = annotationsMap.get(requiredAnnotationName);
  if (annotations != null) {
    for (AnnotationInstance annotationInstance : annotations) {
      if (annotationInstance.target().equals(classInfo)) {
        return true;
      }
    }
  }
  return false;
}
origin: weld/core

private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnotationName) {
  Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotations();
  List<AnnotationInstance> annotations = annotationsMap.get(requiredAnnotationName);
  if (annotations != null) {
    for (AnnotationInstance annotationInstance : annotations) {
      if (annotationInstance.target().equals(classInfo)) {
        return true;
      }
    }
  }
  return false;
}
origin: weld/core

private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnotationName) {
  Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotations();
  List<AnnotationInstance> annotations = annotationsMap.get(requiredAnnotationName);
  if (annotations != null) {
    for (AnnotationInstance annotationInstance : annotations) {
      if (annotationInstance.target().equals(classInfo)) {
        return true;
      }
    }
  }
  return false;
}
origin: org.hibernate/com.springsource.org.hibernate

/**
 * @param classInfo the class info from which to retrieve the annotation instance
 * @param annotationName the annotation to retrieve from the class info
 *
 * @return the single annotation defined on the class or {@code null} in case the annotation is not specified at all
 *
 * @throws org.hibernate.AssertionFailure in case there is there is more than one annotation of this type.
 */
public static AnnotationInstance getSingleAnnotation(ClassInfo classInfo, DotName annotationName)
    throws AssertionFailure {
  return getSingleAnnotation( classInfo.annotations(), annotationName );
}
origin: org.jboss.eap/wildfly-webservices-server-integration

public static boolean isJaxwsEndpointInterface(final ClassInfo clazz) {
  final short flags = clazz.flags();
  if (!Modifier.isInterface(flags)) return false;
  if (!Modifier.isPublic(flags)) return false;
  return clazz.annotations().containsKey(WEB_SERVICE_ANNOTATION);
}
origin: org.jboss.eap/wildfly-webservices-server-integration

private static WebContextAnnotationWrapper getWebContextWrapper(final ClassInfo webServiceClassInfo) {
  if (!webServiceClassInfo.annotations().containsKey(WEB_CONTEXT_ANNOTATION)) return new WebContextAnnotationWrapper(null);
  final AnnotationInstance webContextAnnotation = webServiceClassInfo.annotations().get(WEB_CONTEXT_ANNOTATION).get(0);
  return new WebContextAnnotationWrapper(webContextAnnotation);
}
origin: org.wildfly/wildfly-webservices-server-integration

public static boolean isJaxwsEndpointInterface(final ClassInfo clazz) {
  final short flags = clazz.flags();
  if (!Modifier.isInterface(flags)) return false;
  if (!Modifier.isPublic(flags)) return false;
  return clazz.annotations().containsKey(WEB_SERVICE_ANNOTATION);
}
origin: org.jboss.as/jboss-as-webservices-server-integration

private static WebContextAnnotationWrapper getWebContextWrapper(final ClassInfo webServiceClassInfo) {
  if (!webServiceClassInfo.annotations().containsKey(WEB_CONTEXT_ANNOTATION)) return new WebContextAnnotationWrapper(null);
  final AnnotationInstance webContextAnnotation = webServiceClassInfo.annotations().get(WEB_CONTEXT_ANNOTATION).get(0);
  return new WebContextAnnotationWrapper(webContextAnnotation);
}
origin: org.jboss.weld.environment/weld-environment-common

private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnotationName) {
  Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotations();
  List<AnnotationInstance> annotations = annotationsMap.get(requiredAnnotationName);
  if (annotations != null) {
    for (AnnotationInstance annotationInstance : annotations) {
      if (annotationInstance.target().equals(classInfo)) {
        return true;
      }
    }
  }
  return false;
}
origin: org.hibernate/com.springsource.org.hibernate.core

/**
 * @param classInfo the class info from which to retrieve the annotation instance
 * @param annotationName the annotation to retrieve from the class info
 *
 * @return the single annotation defined on the class or {@code null} in case the annotation is not specified at all
 *
 * @throws org.hibernate.AssertionFailure in case there is there is more than one annotation of this type.
 */
public static AnnotationInstance getSingleAnnotation(ClassInfo classInfo, DotName annotationName)
    throws AssertionFailure {
  return getSingleAnnotation( classInfo.annotations(), annotationName );
}
origin: org.jboss.weld.servlet/weld-servlet-shaded

private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnotationName) {
  Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotations();
  List<AnnotationInstance> annotations = annotationsMap.get(requiredAnnotationName);
  if (annotations != null) {
    for (AnnotationInstance annotationInstance : annotations) {
      if (annotationInstance.target().equals(classInfo)) {
        return true;
      }
    }
  }
  return false;
}
org.jboss.jandexClassInfoannotations

Javadoc

Returns a map indexed by annotation name, with a value list of annotation instances. The annotation instances in this map correspond to both annotations on the class, and every nested element of the class (fields, types, methods, etc).

The target of the annotation instance can be used to determine the location of the annotation usage.

Popular methods of ClassInfo

  • name
  • flags
  • superName
  • methods
  • toString
  • interfaces
  • hasNoArgsConstructor
  • classAnnotations
  • interfaceNames
  • nestingType
  • enclosingClass
    Returns the enclosing class if this is an inner class, or null if this is an anonymous, a local, or
  • <init>
  • enclosingClass,
  • <init>,
  • create,
  • method,
  • simpleName,
  • copyInterfaceTypes,
  • enclosingMethod,
  • field,
  • fieldArray

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • getContentResolver (Context)
  • putExtra (Intent)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Reference (javax.naming)
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now