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

How to use
getAnnotatedSuperclass
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.getAnnotatedSuperclass (Showing top 15 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

Class<?> c = o.getClass();
 AnnotatedType type = c.getAnnotatedSuperclass();
 System.out.println(Arrays.toString(type.getAnnotations()));
origin: stackoverflow.com

 import java.lang.annotation.*;

public class AnnotationTest {

  @Target(ElementType.TYPE_USE)
  @Retention(RetentionPolicy.RUNTIME)
  @interface First { }

  @Target(ElementType.TYPE_USE)
  @Retention(RetentionPolicy.RUNTIME)
  @interface Second { }

  class A { }

  class B extends @First @Second A { }

  public static void main(String[] args) {
    Annotation[] anns = B.class.getAnnotatedSuperclass().getAnnotations();
    System.out.printf("There are %d annotations on B's use of its superclass.%n", anns.length);
    for (Annotation a : anns)
      System.out.println(a.annotationType().getName());
  }
}
origin: stackoverflow.com

public TO getTo() throws Exception{
  if (to == null) {
   try{
     to = ((Class<TO>)((ParameterizedType)this.getClass().
           getGenericSuperclass()).getActualTypeArguments()[0]).newInstance();
   }catch(ClassCastException cce){
     cce.printStackTrace();
     to = ((Class<TO>)((ParameterizedType)(((Class<TO>)
         this.getClass().getAnnotatedSuperclass().getType()).getGenericSuperclass()))
           .getActualTypeArguments()[0]).newInstance();
   }   
  }
  return to;
 }
origin: leangen/graphql-spqr

  private AnnotatedType getSourceType() {
    return GenericTypeReflector.getTypeParameter(getClass().getAnnotatedSuperclass(), AbstractTypeAdapter.class.getTypeParameters()[0]);
  }
}
origin: leangen/graphql-spqr

  private AnnotatedType getTypeArguments(int index) {
    return GenericTypeReflector.getTypeParameter(getClass().getAnnotatedSuperclass(), CachingMapper.class.getTypeParameters()[index]);
  }
}
origin: leangen/graphql-spqr

public AbstractTypeSubstitutingMapper() {
  substituteType = GenericTypeReflector.getTypeParameter(getClass().getAnnotatedSuperclass(), AbstractTypeSubstitutingMapper.class.getTypeParameters()[0]);
}
origin: stackoverflow.com

List<?> token = new ArrayList<@NonNull String>() {};
 fullType("", token.getClass().getAnnotatedSuperclass());
origin: stackoverflow.com

 public TO getTo() throws Exception {
  if(to == null) {
    try {
      to = ((Class<TO>) ((ParameterizedType) this.getClass().getGenericSuperclass())
          .getActualTypeArguments()[0]).newInstance();
    } catch(ClassCastException cce) {
      cce.printStackTrace();
      to = ((Class<TO>) ((ParameterizedType) (((Class<TO>) this.getClass()
          .getAnnotatedSuperclass().getType()).getGenericSuperclass()))
              .getActualTypeArguments()[0]).newInstance();
    }
  }
  return to;
}
origin: io.leangen.geantyref/geantyref

private AnnotatedType extractType() {
  AnnotatedType t = getClass().getAnnotatedSuperclass();
  if (!(t instanceof AnnotatedParameterizedType)) {
    throw new RuntimeException("Invalid TypeToken; must specify type parameters");
  }
  AnnotatedParameterizedType pt = (AnnotatedParameterizedType) t;
  if (((ParameterizedType) pt.getType()).getRawType() != TypeToken.class) {
    throw new RuntimeException("Invalid TypeToken; must directly extend TypeToken");
  }
  return pt.getAnnotatedActualTypeArguments()[0];
}
origin: rulebook-rules/rulebook

 /**
  * Gets the POJO Rules to be used by the RuleBook via reflection of the specified package.
  * @return  a List of POJO Rules
  */
 protected List<Class<?>> getPojoRules() {
  Reflections reflections = new Reflections(_package);

  List<Class<?>> rules = reflections
    .getTypesAnnotatedWith(com.deliveredtechnologies.rulebook.annotation.Rule.class).stream()
    .filter(rule -> rule.getAnnotatedSuperclass() != null) // Include classes only, exclude interfaces, etc.
    .filter(rule -> _subPkgMatch.test(rule.getPackage().getName()))
    .collect(Collectors.toList());

  rules.sort(comparingInt(aClass ->
    getAnnotation(com.deliveredtechnologies.rulebook.annotation.Rule.class, aClass).order()));

  return rules;
 }
}
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: com.oracle.substratevm/svm

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

AnnotatedType superClass = clazz.getAnnotatedSuperclass();
java.langClassgetAnnotatedSuperclass

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
  • CodeWhisperer alternatives
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