Example #1
0
 /**
  * Gets the {@code Type} that represents the superclass of this {@code class}.
  *
  * @return an instance of {@code Type} representing the superclass.
  */
 public Type getGenericSuperclass() {
   GenericSignatureParser parser = new GenericSignatureParser(getClassLoader());
   parser.parseForClass(this, getSignatureAttribute());
   return Types.getType(parser.superclassType);
 }
Example #2
0
 /**
  * Returns an array containing {@code TypeVariable} objects for type variables declared by the
  * generic class represented by this {@code Class}. Returns an empty array if the class is not
  * generic.
  *
  * @return an array with the type variables of the class represented by this class.
  */
 @SuppressWarnings("unchecked")
 public synchronized TypeVariable<Class<T>>[] getTypeParameters() {
   GenericSignatureParser parser = new GenericSignatureParser(getClassLoader());
   parser.parseForClass(this, getSignatureAttribute());
   return parser.formalTypeParameters.clone();
 }
Example #3
0
 /**
  * Gets the {@link Type}s of the interfaces that this {@code Class} directly implements. If the
  * {@code Class} represents a primitive type or {@code void} then an empty array is returned.
  *
  * @return an array of {@link Type} instances directly implemented by the class represented by
  *     this {@code class}.
  */
 public Type[] getGenericInterfaces() {
   GenericSignatureParser parser = new GenericSignatureParser(getClassLoader());
   parser.parseForClass(this, getSignatureAttribute());
   return Types.getClonedTypeArray(parser.interfaceTypes);
 }