congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Type
Code IndexAdd Tabnine to your IDE (free)

How to use
Type
in
org.jboss.jandex

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

Refine searchRefine arrow

  • ClassInfo
  • DotName
  • MethodInfo
  • AnnotationValue
  • AnnotationInstance
  • FieldInfo
origin: wildfly/wildfly

private MethodIdentifier getMethodIdentifier(final AnnotationTarget target) {
  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();
  }
  return MethodIdentifier.getIdentifier(methodInfo.returnType().name().toString(), methodInfo.name(), args);
}
origin: wildfly/wildfly

@Override
public Collection<Annotation> getAnnotation(Class<?> annotationClass) {
  List<AnnotationInstance> instances = backingRepository.getAnnotations(DotName.createSimple(annotationClass
      .getName()));
  ArrayList<Annotation> annotations = new ArrayList<Annotation>(instances.size());
  for (AnnotationInstance instance : instances) {
    AnnotationTarget target = instance.target();
    Annotation annotation = null;
    if (target instanceof MethodInfo) {
      MethodInfo m = (MethodInfo) target;
      List<String> parameterTypes = new ArrayList<String>(m.args().length);
      for (Type type : m.args()) {
        parameterTypes.add(type.toString());
      String declaringClass = m.declaringClass().name().toString();
      annotation = new AnnotationImpl(declaringClass, cl, parameterTypes, m.name(), true, false, annotationClass);
      String declaringClass = f.declaringClass().name().toString();
      annotation = new AnnotationImpl(declaringClass, cl, null, f.name(), false, true, annotationClass);
      annotation = new AnnotationImpl(c.name().toString(), cl, null, null, false, false, annotationClass);
origin: wildfly/wildfly

final AnnotationTarget annotationTarget = annotation.target();
final AnnotationValue nameValue = annotation.value("name");
final String name = (nameValue != null) ? replacer.replaceProperties(nameValue.asString()) : null;
final AnnotationValue typeValue = annotation.value("type");
final String type = typeValue != null ? typeValue.asClass().name().toString() : null;
if (annotationTarget instanceof FieldInfo) {
  final FieldInfo fieldInfo = (FieldInfo) annotationTarget;
  final ClassInfo classInfo = fieldInfo.declaringClass();
  EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
  processFieldResource(phaseContext, fieldInfo, name, type, classDescription, annotation, eeModuleDescription, module, applicationClasses, replacer);
} else if (annotationTarget instanceof MethodInfo) {
  final MethodInfo methodInfo = (MethodInfo) annotationTarget;
  ClassInfo classInfo = methodInfo.declaringClass();
  EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
  processMethodResource(phaseContext, methodInfo, name, type, classDescription, annotation, eeModuleDescription, module, applicationClasses, replacer);
} else if (annotationTarget instanceof ClassInfo) {
  final ClassInfo classInfo = (ClassInfo) annotationTarget;
  EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
  processClassResource(phaseContext, name, type, classDescription, annotation, eeModuleDescription, module, applicationClasses, replacer);
if (annotationTarget instanceof ClassInfo) {
  final ClassInfo classInfo = (ClassInfo) annotationTarget;
  final AnnotationInstance[] values = outerAnnotation.value("value").asNestedArray();
  for (AnnotationInstance annotation : values) {
    final AnnotationValue nameValue = annotation.value("name");
    final String name = (nameValue != null) ? replacer.replaceProperties(nameValue.asString()) : null;
    final AnnotationValue typeValue = annotation.value("type");
    final String type = (typeValue != null) ? typeValue.asClass().name().toString() : null;
    EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
origin: wildfly/wildfly

protected void processFieldResource(final DeploymentPhaseContext phaseContext, final FieldInfo fieldInfo, final String name, final String type, final EEModuleClassDescription classDescription, final AnnotationInstance annotation, final EEModuleDescription eeModuleDescription, final Module module, final EEApplicationClasses applicationClasses, final PropertyReplacer replacer) throws DeploymentUnitProcessingException {
  final String fieldName = fieldInfo.name();
  final String injectionType = isEmpty(type) || type.equals(Object.class.getName()) ? fieldInfo.type().name().toString() : type;
  final String localContextName = isEmpty(name) ? fieldInfo.declaringClass().name().toString() + "/" + fieldName : name;
  final InjectionTarget targetDescription = new FieldInjectionTarget(fieldInfo.declaringClass().name().toString(), fieldName, fieldInfo.type().name().toString());
  process(phaseContext, classDescription, annotation, injectionType, localContextName, targetDescription, eeModuleDescription, module, applicationClasses, replacer);
}
origin: org.wildfly/wildfly-jpa

private void processMethod(final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, final MethodInfo methodInfo,
              final EEModuleClassDescription eeModuleClassDescription) throws
  DeploymentUnitProcessingException {
  final String methodName = methodInfo.name();
  if (!methodName.startsWith("set") || methodInfo.args().length != 1) {
    eeModuleClassDescription.setInvalid(JpaLogger.ROOT_LOGGER.setterMethodOnlyAnnotation(annotation.name().toString(), methodInfo));
    return;
  }
  final String contextNameSuffix = methodName.substring(3, 4).toLowerCase(Locale.ENGLISH) + methodName.substring(4);
  final AnnotationValue declaredNameValue = annotation.value("name");
  final String declaredName = declaredNameValue != null ? declaredNameValue.asString() : null;
  final String localContextName;
  if (declaredName == null || declaredName.isEmpty()) {
    localContextName = methodInfo.declaringClass().name().toString() + "/" + contextNameSuffix;
  } else {
    localContextName = declaredName;
  }
  final String injectionType = methodInfo.args()[0].name().toString();
  final InjectionSource bindingSource = this.getBindingSource(deploymentUnit, annotation, injectionType, eeModuleClassDescription);
  if (bindingSource != null) {
    final BindingConfiguration bindingConfiguration = new BindingConfiguration(localContextName, bindingSource);
    eeModuleClassDescription.getBindingConfigurations().add(bindingConfiguration);
    // setup the injection configuration
    final InjectionTarget injectionTarget = new MethodInjectionTarget(methodInfo.declaringClass().name().toString(), methodName, methodInfo.args()[0].name().toString());
    // source is always local ENC jndi name
    final InjectionSource injectionSource = new LookupInjectionSource(localContextName);
    final ResourceInjectionConfiguration injectionConfiguration = new ResourceInjectionConfiguration(injectionTarget, injectionSource);
    eeModuleClassDescription.addResourceInjection(injectionConfiguration);
  }
}
origin: wildfly/jandex

addClassName(clazz.name());
if (clazz.superName() != null)
  addClassName(clazz.superName());
for (DotName intf: clazz.interfaces())
    AnnotationTarget target = instance.target();
    if (target instanceof FieldInfo) {
      FieldInfo field = (FieldInfo) target;
      intern(field.name());
      addClassName(field.type().name());
      intern(method.name());
      for (Type type : method.args())
        addClassName(type.name());
      addClassName(method.returnType().name());
      intern(param.method().name());
      for (Type type : param.method().args())
        addClassName(type.name());
      addClassName(param.method().returnType().name());
    for (AnnotationValue value : instance.values())
      buildAValueEntries(index, value);
origin: org.jboss.eap/wildfly-jpa

private void processField(final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, final FieldInfo fieldInfo,
             final EEModuleClassDescription eeModuleClassDescription) throws
  DeploymentUnitProcessingException {
  final String fieldName = fieldInfo.name();
  final AnnotationValue declaredNameValue = annotation.value("name");
  final String declaredName = declaredNameValue != null ? declaredNameValue.asString() : null;
  final String localContextName;
  if (declaredName == null || declaredName.isEmpty()) {
    localContextName = fieldInfo.declaringClass().name().toString() + "/" + fieldName;
  } else {
    localContextName = declaredName;
  }
  //final AnnotationValue declaredTypeValue = annotation.value("type");
  final DotName declaredTypeDotName = fieldInfo.type().name();
  final DotName injectionTypeDotName = declaredTypeDotName == null || declaredTypeDotName.toString().equals(Object.class.getName()) ? fieldInfo.type().name() : declaredTypeDotName;
  final String injectionType = injectionTypeDotName.toString();
  final InjectionSource bindingSource = this.getBindingSource(deploymentUnit, annotation, injectionType, eeModuleClassDescription);
  if (bindingSource != null) {
    final BindingConfiguration bindingConfiguration = new BindingConfiguration(localContextName, bindingSource);
    eeModuleClassDescription.getBindingConfigurations().add(bindingConfiguration);
    // setup the injection target
    final InjectionTarget injectionTarget = new FieldInjectionTarget(fieldInfo.declaringClass().name().toString(), fieldName, fieldInfo.type().name().toString());
    // source is always local ENC jndi
    final InjectionSource injectionSource = new LookupInjectionSource(localContextName);
    final ResourceInjectionConfiguration injectionConfiguration = new ResourceInjectionConfiguration(injectionTarget, injectionSource);
    eeModuleClassDescription.addResourceInjection(injectionConfiguration);
  }
}
origin: wildfly/wildfly

  private String classValueOrNull(final AnnotationInstance annotation, final String attribute) {
    final AnnotationValue value = annotation.value(attribute);
    return (value != null) ? value.asClass().name().toString() : null;
  }
}
origin: wildfly/wildfly

private String getMessageListenerInterface(final CompositeIndex compositeIndex, final AnnotationInstance messageBeanAnnotation) throws DeploymentUnitProcessingException {
  final AnnotationValue value = messageBeanAnnotation.value("messageListenerInterface");
  if (value != null)
    return value.asClass().name().toString();
  final ClassInfo beanClass = (ClassInfo) messageBeanAnnotation.target();
  final Set<DotName> interfaces = new HashSet<DotName>(getPotentialViewInterfaces(beanClass));
  // check super class(es) of the bean
  DotName superClassDotName = beanClass.superName();
  while (interfaces.isEmpty() && superClassDotName != null && !superClassDotName.toString().equals(Object.class.getName())) {
    final ClassInfo superClass = compositeIndex.getClassByName(superClassDotName);
    if (superClass == null) {
      break;
    }
    interfaces.addAll(getPotentialViewInterfaces(superClass));
    // move to next super class
    superClassDotName = superClass.superName();
  }
  if (interfaces.size() != 1)
    throw EjbLogger.ROOT_LOGGER.mdbDoesNotImplementNorSpecifyMessageListener(beanClass);
  return interfaces.iterator().next().toString();
}
origin: org.hibernate/com.springsource.org.hibernate.core

      .getAnnotations( PseudoJpaDotNames.DEFAULT_ENTITY_LISTENERS );
  for ( AnnotationInstance annotation : defaultEntityListenerAnnotations ) {
    for ( Type callbackClass : annotation.value().asClassArray() ) {
      String callbackClassName = callbackClass.name().toString();
      try {
        processDefaultJpaCallbacks( callbackClassName, callbackClassList );
List<AnnotationInstance> annotationList = getClassInfo().annotations().get( JPADotNames.ENTITY_LISTENERS );
if ( annotationList != null ) {
  for ( AnnotationInstance annotation : annotationList ) {
    for ( Type callbackClass : annotation.value().asClassArray() ) {
      String callbackClassName = callbackClass.name().toString();
      try {
        processJpaCallbacks( callbackClassName, true, callbackClassList );
      error.getMessage() + "entity/mapped superclass " + getClassInfo().name().toString()
  );
origin: org.wildfly/wildfly-osgi-service

  private boolean hasInjectionPoint(DeploymentUnit depUnit, String anName) {
    boolean result = false;
    CompositeIndex compositeIndex = depUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
    List<AnnotationInstance> annotationList = compositeIndex.getAnnotations(DotName.createSimple(anName));
    for (AnnotationInstance instance : annotationList) {
      AnnotationTarget target = instance.target();
      if (target instanceof FieldInfo) {
        FieldInfo fieldInfo = (FieldInfo) target;
        String typeName = fieldInfo.type().toString();
        if (typeName.startsWith("org.osgi.framework") || typeName.startsWith("org.osgi.service")) {
          LOGGER.debugf("OSGi injection point of type '%s' detected: %s", typeName, fieldInfo.declaringClass());
          result = true;
          break;
        }
      }
    }
    return result;
  }
}
origin: wildfly/wildfly

  @Override
  protected String[] fromAnnotation(final AnnotationInstance annotationInstance, final PropertyReplacer propertyReplacer) {
    final Type[] classes =  annotationInstance.value().asClassArray();
    final String[] ret = new String[classes.length];
    for(int i = 0; i < classes.length; ++i) {
      ret[i] = classes[i].name().toString();
    }
    return ret;
  }
}
origin: org.hibernate/com.springsource.org.hibernate

            Map<Class<?>, String> callbacksByClass,
            boolean isListener) {
if ( methodInfo.returnType().kind() != Kind.VOID ) {
  throw new PersistenceException( "Callback method " + methodInfo.name() + " must have a void return type in " );
if ( Modifier.isStatic( methodInfo.flags() ) || Modifier.isFinal( methodInfo.flags() ) ) {
  throw new PersistenceException( "Callback method " + methodInfo.name() + " must not be static or final in " );
    throw new PersistenceException( "Callback method " + methodInfo.name() + " must have exactly one argument in " );
  String argTypeName = argTypes[0].name().toString();
  if ( !argTypeName.equals( Object.class.getName() ) && !argTypeName.equals( getName() ) ) {
    throw new PersistenceException(
origin: mbechler/serianalyzer

/**
 * @param i
 * @return
 * @throws SerianalyzerException
 */
static String makeSignature ( MethodInfo i, boolean fix ) throws SerianalyzerException {
  StringBuilder sb = new StringBuilder();
  sb.append('(');
  ClassInfo declaringImpl = i.declaringClass();
  if ( fix && "<init>".equals(i.name()) && declaringImpl.nestingType() == NestingType.INNER ) { //$NON-NLS-1$
    // there seems to be some sort of bug, missing the the outer instance parameter in the constructor
    if ( !Modifier.isStatic(declaringImpl.flags()) ) {
      org.jboss.jandex.Type enclosingClass = org.jboss.jandex.Type.create(declaringImpl.enclosingClass(), Kind.CLASS);
      org.jboss.jandex.Type firstArg = i.parameters().size() > 0 ? i.parameters().get(0) : null;
      if ( firstArg instanceof TypeVariable ) {
        firstArg = firstArg.asTypeVariable().bounds().get(0);
      }
      if ( firstArg == null || !firstArg.equals(enclosingClass) ) {
        sb.append(toString(enclosingClass));
      }
    }
  }
  for ( org.jboss.jandex.Type p : i.parameters() ) {
    sb.append(toString(p));
  }
  sb.append(')');
  sb.append(toString(i.returnType()));
  return sb.toString();
}
origin: wildfly/jandex

private Index readClasses(PackedDataInputStream stream,
             int annotationsSize, int implementorsSize, int subclassesSize) throws IOException {
  int classesSize = stream.readPackedU32();
  HashMap<DotName, ClassInfo> classes = new HashMap<DotName, ClassInfo>(classesSize);
  HashMap<DotName, List<ClassInfo>> subclasses = new HashMap<DotName, List<ClassInfo>>(subclassesSize);
  HashMap<DotName, List<ClassInfo>> implementors = new HashMap<DotName, List<ClassInfo>>(implementorsSize);
  HashMap<DotName, List<AnnotationInstance>> masterAnnotations =
      new HashMap<DotName, List<AnnotationInstance>>(annotationsSize);
  for (int i = 0; i < classesSize; i++) {
    ClassInfo clazz = readClassEntry(stream, masterAnnotations);
    addClassToMap(subclasses, clazz.superName(), clazz);
    for (Type interfaceType : clazz.interfaceTypeArray()) {
      addClassToMap(implementors, interfaceType.name(), clazz);
    }
    classes.put(clazz.name(), clazz);
  }
  return new Index(masterAnnotations, subclasses, implementors, classes);
}
origin: wildfly/jandex

private void buildAValueEntries(Index index, AnnotationValue value) {
  intern(value.name());
  if (value instanceof AnnotationValue.StringValue) {
    intern(value.asString());
  } else if (value instanceof AnnotationValue.ClassValue) {
    addClassName(value.asClass().name());
  } else if (value instanceof AnnotationValue.EnumValue) {
    addClassName(value.asEnumType());
    intern(value.asEnum());
  } else if (value instanceof AnnotationValue.ArrayValue) {
    for (AnnotationValue entry : value.asArray())
      buildAValueEntries(index, entry);
  } else if (value instanceof AnnotationValue.NestedAnnotation) {
    AnnotationInstance instance = value.asNested();
    Collection<AnnotationValue> values = instance.values();
    addClassName(instance.name());
    for (AnnotationValue entry : values) {
      buildAValueEntries(index, entry);
    }
  }
}
origin: org.hibernate/com.springsource.org.hibernate

  private static <T> T explicitAnnotationParameter(AnnotationValue annotationValue, Class<T> type) {
    Object returnValue = annotationValue.value();

    // if the jandex return type is Type we actually try to retrieve a class parameter
    // for our purposes we just return the fqcn of the class
    if ( returnValue instanceof Type ) {
      returnValue = ( (Type) returnValue ).name().toString();
    }

    // arrays we have to handle explicitly
    if ( type.isArray() ) {
      AnnotationValue[] values = (AnnotationValue[]) returnValue;
      Class<?> componentType = type.getComponentType();
      Object[] arr = (Object[]) Array.newInstance( componentType, values.length );
      for ( int i = 0; i < values.length; i++ ) {
        arr[i] = componentType.cast( values[i].value() );
      }
      returnValue = arr;
    }

    return type.cast( returnValue );
  }
}
origin: wildfly/wildfly

  @Override
  protected String fromAnnotation(final AnnotationInstance annotationInstance, final PropertyReplacer propertyReplacer) {
    AnnotationValue value = annotationInstance.value();
    return value.asClass().toString();
  }
}
origin: wildfly/jandex

private void processClassInfo(DataInputStream data) throws IOException {
  short flags = (short) data.readUnsignedShort();
  DotName thisName = decodeClassEntry(data.readUnsignedShort());
  int superIndex = data.readUnsignedShort();
  DotName superName = (superIndex != 0) ? decodeClassEntry(superIndex) : null;
  int numInterfaces = data.readUnsignedShort();
  List<Type> interfaces = new ArrayList<Type>(numInterfaces);
  for (int i = 0; i < numInterfaces; i++) {
    interfaces.add(intern(new ClassType(decodeClassEntry(data.readUnsignedShort()))));
  }
  Type[] interfaceTypes = intern(interfaces.toArray(new Type[interfaces.size()]));
  Type superClassType = superName == null ? null : intern(new ClassType(superName));
  this.classAnnotations = new HashMap<DotName, List<AnnotationInstance>>();
  this.currentClass = new ClassInfo(thisName, superClassType, flags, interfaceTypes, classAnnotations);
  if (superName != null)
    addSubclass(superName, currentClass);
  for (int i = 0; i < numInterfaces; i++) {
    addImplementor(interfaces.get(i).name(), currentClass);
  }
  classes.put(currentClass.name(), currentClass);
}
origin: org.hibernate/com.springsource.org.hibernate

private static Type getType(Class clazz) {
  return Type.create( DotName.createSimple( clazz.getName() ), getTypeKind( clazz ) );
}
org.jboss.jandexType

Javadoc

Represents a Java type declaration usage that is specified on methods, fields, classes, annotations, or other types. A type can be any class based type (interface, class, annotation), any primitive, any array, any generic type declaration, or void.

A type usage may have annotations associated with its declaration. A type is equal to another type if, and only if, it represents the same exact definition including the annotations specific to its usage.

To reduce memory overhead, type instances are often shared between their enclosing classes.

Most used methods

  • name
  • toString
  • create
  • kind
  • asTypeVariable
    Casts this type to a org.jboss.jandex.ParameterizedType and returns it if the kind is Kind#TYPE_VARI
  • asArrayType
    Casts this type to an org.jboss.jandex.ArrayType and returns it if the kind is Kind#ARRAYThrows an e
  • asClassType
    Casts this type to a org.jboss.jandex.ClassType and returns it if the kind is Kind#CLASSThrows an ex
  • asParameterizedType
    Casts this type to a org.jboss.jandex.ParameterizedType and returns it if the kind is Kind#PARAMETER
  • asPrimitiveType
    Casts this type to a org.jboss.jandex.PrimitiveType and returns it if the kind is Kind#PRIMITIVEThro
  • asUnresolvedTypeVariable
    Casts this type to an org.jboss.jandex.UnresolvedTypeVariable and returns it if the kind is Kind#UNR
  • asWildcardType
    Casts this type to a org.jboss.jandex.WildcardType and returns it if the kind is Kind#WILDCARD_TYPET
  • equals
    Compares this Type with another type, and returns true if they are equivalent. A type is equivalent
  • asWildcardType,
  • equals,
  • addAnnotation,
  • annotation,
  • annotationArray,
  • appendAnnotations,
  • asVoidType,
  • copyType,
  • hashCode

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • BoxLayout (javax.swing)
  • JFileChooser (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now