Tabnine Logo
Class.getAnnotatedInterfaces
Code IndexAdd Tabnine to your IDE (free)

How to use
getAnnotatedInterfaces
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.getAnnotatedInterfaces (Showing top 13 results out of 315)

origin: spring-cloud/spring-cloud-config

/**
 * Given a Factory Name return the generic type parameters of the factory (The actual repository class, and its properties class)o
 */
public static Type[] getEnvironmentRepositoryFactoryTypeParams(ConfigurableListableBeanFactory beanFactory, String factoryName) {
  MethodMetadata methodMetadata = (MethodMetadata) beanFactory.getBeanDefinition(factoryName).getSource();
  Class<?> factoryClass = null;
  try {
    factoryClass = Class.forName(methodMetadata.getReturnTypeName());
  } catch (ClassNotFoundException e) {
    throw new IllegalStateException(e);
  }
  Optional<AnnotatedType> annotatedFactoryType = Arrays.stream(factoryClass.getAnnotatedInterfaces())
      .filter(i -> {
        ParameterizedType parameterizedType = (ParameterizedType) i.getType();
        return parameterizedType.getRawType().equals(EnvironmentRepositoryFactory.class);
      }).findFirst();
  ParameterizedType factoryParameterizedType = (ParameterizedType) annotatedFactoryType
      .orElse(factoryClass.getAnnotatedSuperclass()).getType();
  return factoryParameterizedType.getActualTypeArguments();
}
origin: stackoverflow.com

for (AnnotatedType t :  consumer.getClass().getAnnotatedInterfaces()) {
  annotation = t.getAnnotation(MyTypeAnnotation.class);
  if (annotation != null) {
origin: stackoverflow.com

 @Retention(RetentionPolicy.RUNTIME)
public @interface X {
  String[] value();
}

@X({"a", "b", "c"})
interface AnInterface {}

public static class TestClass implements AnInterface {}

public static void main(String[] args) {
  // annotations are not inherited, empty array
  System.out.println(Arrays.toString(TestClass.class.getAnnotations()));

  // check if TestClass is annotated with X and get X.value()
  Arrays.stream(TestClass.class.getAnnotatedInterfaces())
      .filter(type -> type.getType().equals(AnInterface.class))
      .map(type -> (Class<AnInterface>) type.getType())
      .findFirst()
      .ifPresent(anInterface -> {
        String[] value = anInterface.getAnnotation(X.class).value();
        System.out.println(Arrays.toString(value));
      });
}
origin: org.hibernate.validator/hibernate-validator

private static void determineValueExtractorDefinitions(List<AnnotatedType> valueExtractorDefinitions, Class<?> extractorImplementationType) {
  if ( !ValueExtractor.class.isAssignableFrom( extractorImplementationType ) ) {
    return;
  }
  Class<?> superClass = extractorImplementationType.getSuperclass();
  if ( superClass != null && !Object.class.equals( superClass ) ) {
    determineValueExtractorDefinitions( valueExtractorDefinitions, superClass );
  }
  for ( Class<?> implementedInterface : extractorImplementationType.getInterfaces() ) {
    if ( !ValueExtractor.class.equals( implementedInterface ) ) {
      determineValueExtractorDefinitions( valueExtractorDefinitions, implementedInterface );
    }
  }
  for ( AnnotatedType annotatedInterface : extractorImplementationType.getAnnotatedInterfaces() ) {
    if ( ValueExtractor.class.equals( ReflectionHelper.getClassFromType( annotatedInterface.getType() ) ) ) {
      valueExtractorDefinitions.add( annotatedInterface );
    }
  }
}
origin: funcatron/funcatron

Arrays.stream(c.getAnnotatedInterfaces()).
    map(a -> a.getType()).
    filter(a -> a instanceof ParameterizedType).
origin: org.apache.tomee.patch/bval-jsr

private void hierarchy(Consumer<ContainerElementKey> sink) {
  final TypeVariable<?> var;
  if (typeArgumentIndex == null) {
    var = null;
  } else {
    var = containerClass.getTypeParameters()[typeArgumentIndex.intValue()];
  }
  final Lazy<Set<ContainerElementKey>> round = new Lazy<>(LinkedHashSet::new);
  Stream
    .concat(Stream.of(containerClass.getAnnotatedSuperclass()),
      Stream.of(containerClass.getAnnotatedInterfaces()))
    .filter(AnnotatedParameterizedType.class::isInstance).map(AnnotatedParameterizedType.class::cast)
    .forEach(t -> {
      final AnnotatedType[] args = ((AnnotatedParameterizedType) t).getAnnotatedActualTypeArguments();
      for (int i = 0; i < args.length; i++) {
        final Type boundArgumentType = args[i].getType();
        if (boundArgumentType instanceof Class<?> || boundArgumentType.equals(var)) {
          round.get().add(new ContainerElementKey(t, Integer.valueOf(i)));
        }
      }
    });
  round.optional().ifPresent(s -> {
    s.forEach(sink);
    // recurse:
    s.forEach(k -> k.hierarchy(sink));
  });
}
origin: org.apache.bval/bval-jsr

private void hierarchy(Consumer<ContainerElementKey> sink) {
  final TypeVariable<?> var;
  if (typeArgumentIndex == null) {
    var = null;
  } else {
    var = containerClass.getTypeParameters()[typeArgumentIndex.intValue()];
  }
  final Lazy<Set<ContainerElementKey>> round = new Lazy<>(LinkedHashSet::new);
  Stream
    .concat(Stream.of(containerClass.getAnnotatedSuperclass()),
      Stream.of(containerClass.getAnnotatedInterfaces()))
    .filter(AnnotatedParameterizedType.class::isInstance).map(AnnotatedParameterizedType.class::cast)
    .forEach(t -> {
      final AnnotatedType[] args = ((AnnotatedParameterizedType) t).getAnnotatedActualTypeArguments();
      for (int i = 0; i < args.length; i++) {
        final Type boundArgumentType = args[i].getType();
        if (boundArgumentType instanceof Class<?> || boundArgumentType.equals(var)) {
          round.get().add(new ContainerElementKey(t, Integer.valueOf(i)));
        }
      }
    });
  round.optional().ifPresent(s -> {
    s.forEach(sink);
    // recurse:
    s.forEach(k -> k.hierarchy(sink));
  });
}
origin: org.apache.bval/bval-jsr

final Lazy<Set<ContainerElementKey>> result = new Lazy<>(HashSet::new);
Stream.of(extractorType.getAnnotatedInterfaces()).filter(AnnotatedParameterizedType.class::isInstance)
  .map(AnnotatedParameterizedType.class::cast)
  .filter(apt -> ValueExtractor.class.equals(((ParameterizedType) apt.getType()).getRawType()))
origin: org.apache.tomee.patch/bval-jsr

final Lazy<Set<ContainerElementKey>> result = new Lazy<>(HashSet::new);
Stream.of(extractorType.getAnnotatedInterfaces()).filter(AnnotatedParameterizedType.class::isInstance)
  .map(AnnotatedParameterizedType.class::cast)
  .filter(apt -> ValueExtractor.class.equals(((ParameterizedType) apt.getType()).getRawType()))
origin: org.eclipse.kapua/kapua-commons

String serviceInterface = impementedClass[0].getAnnotatedInterfaces()[0].getType().getTypeName();
String genericsList = serviceInterface.substring(serviceInterface.indexOf('<') + 1, serviceInterface.indexOf('>'));
String[] entityClassesToScan = genericsList.replaceAll("\\,", "").split(" ");
origin: eclipse/kapua

String serviceInterface = impementedClass[0].getAnnotatedInterfaces()[0].getType().getTypeName();
String genericsList = serviceInterface.substring(serviceInterface.indexOf('<') + 1, serviceInterface.indexOf('>'));
String[] entityClassesToScan = genericsList.replaceAll("\\,", "").split(" ");
origin: com.oracle.substratevm/svm

  allAnnotatedInterfaces = javaClass.getAnnotatedInterfaces();
} catch (MalformedParameterizedTypeException | TypeNotPresentException | NoClassDefFoundError t) {
origin: io.leangen.geantyref/geantyref

AnnotatedType[] superInterfaces = clazz.getAnnotatedInterfaces();
AnnotatedType superClass = clazz.getAnnotatedSuperclass();
java.langClassgetAnnotatedInterfaces

Popular methods of Class

  • getName
    Returns the name of the class represented by this Class. For a description of the format which is us
  • getSimpleName
  • getClassLoader
  • isAssignableFrom
    Determines if the class or interface represented by this Class object is either the same as, or is a
  • forName
    Returns the Class object associated with the class or interface with the given string name, using th
  • newInstance
    Returns a new instance of the class represented by this Class, created by invoking the default (that
  • getMethod
    Returns a Method object that reflects the specified public member method of the class or interface r
  • getResourceAsStream
    Finds a resource with a given name. The rules for searching resources associated with a given class
  • getSuperclass
    Returns the Class representing the superclass of the entity (class, interface, primitive type or voi
  • getConstructor
  • cast
    Casts an object to the class or interface represented by this Class object.
  • isInstance
  • cast,
  • isInstance,
  • getCanonicalName,
  • getDeclaredField,
  • isArray,
  • getAnnotation,
  • getDeclaredFields,
  • getResource,
  • getDeclaredMethod,
  • getMethods

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JFileChooser (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top PhpStorm plugins
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