Interface ClassInfo

All Superinterfaces:
Info

public interface ClassInfo extends Info

Info type used to represent a class.

  • Field Details

    • OBJECT_CLASS_NAME

      static final String OBJECT_CLASS_NAME

      Naming constant: The qualified name of java.lang.Object.

      See Also:
    • SERIALIZABLE_CLASS_NAME

      static final String SERIALIZABLE_CLASS_NAME

      Naming constant: The qualified name of java.io.Serializable.

      See Also:
    • EXTERNALIZABLE_CLASS_NAME

      static final String EXTERNALIZABLE_CLASS_NAME

      Naming constant: The qualified name of java.io.Externalizable.

      See Also:
    • REMOTE_EXCEPTION_CLASS_NAME

      static final String REMOTE_EXCEPTION_CLASS_NAME

      Naming constant: The qualified name of java.rmi.RemoteException.

      See Also:
    • EJB_EXCEPTION_CLASS_NAME

      static final String EJB_EXCEPTION_CLASS_NAME

      Naming constant: The qualified name of javax.ejb.EJBException.

      See Also:
  • Method Details

    • isArtificial

      boolean isArtificial()

      Tell if this class info was created to represent an unloadable class. Stub values are assigned, and the interface and superclass values are forced.

      Returns:
      True if this class object is artificial. Otherwise, false.
    • isArray

      boolean isArray()

      Tell if this class object represents an array type.

      Returns:
      True if this class object represents an array type. Otherwise, false.
    • isPrimitive

      boolean isPrimitive()

      Tell if this class object represents a primitive type (for example, int).

      Returns:
      True if this class object represents a primitive type. Otherwise, false.
    • isDelayedClass

      boolean isDelayedClass()

      Tell if this class object is implemented as a delayed class (as opposed to a non-delayed class).

      A delayed class will have a backing non-delayed class. Whether a class object is returned as a delayed or as a non-delayed class object is a detail of the implementation. However, the expectation is that frequently used classes (for example, classes from java.lang are never returned as delayed classes. Very likely, classes with annotations will not be returned as delayed classes.

      Returns:
      True if the class object is implemented as a delayed class. False if the class object is implemented as a non-delayed class. isNonDelayedClass()
    • isNonDelayedClass

      boolean isNonDelayedClass()

      Tell if this class object is implemented as a non-delayed class (as opposed to a delayed class).

      Returns:
      True if the class object is implemented as a non-delayed class. False if the class object is implemented as a delayed class. isDelayedClass()
    • getPackageName

      String getPackageName()

      Answer the name of the package of this class object.

      Retrieval of the package name is preferred to retrieving the entire package object.

      Returns:
      The name of the package of this class object. getPackage()
    • getPackage

      PackageInfo getPackage()

      Answer the package object of this class object.

      Retrieval of the package name is preferred to retrieving the entire package object.

      Returns:
      The package object of this class object. getPackageName()
    • isJavaClass

      boolean isJavaClass()

      Tell if this class object encodes a distinguished java class. Which java classes are distinguished is an implementation detail. (The current implementation distinguishes all classes under java, as well as all class under javax.ejb and all classes under javax.servlet.) Classes are distinguished to assist in telling which classes are to be delayed.

      Returns:
      True if this class is a distinguished java class. Otherwise, false.
    • isInterface

      boolean isInterface()

      Tell if this class object represents an interface (that is, is defined using the keyword interface, as opposed to representing a concrete (although possibly abstract) class.

      Returns:
      True if this class object represents an interface. Otherwise, false.
    • getInterfaceNames

      List<String> getInterfaceNames()

      Answer the names of the immediately declared interfaces of this class object as a set.

      Returns:
      The names of the immediately declared interfaces of this class object as a set. getInterfaces()
    • getInterfaces

      List<? extends ClassInfo> getInterfaces()

      Answer the immediately declared interfaces of this class object.

      Retrieval of the interface names is preferred to retrieval of the class objects of the interfaces.

      Returns:
      The names of the immediately declared interfaces of this class object as a set. getInterfaceNames()
    • isAnnotationClass

      boolean isAnnotationClass()

      Tell if this class object is for an annotation class. That is, whether java.lang.annotation.Annotation is one of the interfaces of the class.

      Returns:
      True if this class object is for an annotation class. Otherwise, false.
    • getSuperclassName

      String getSuperclassName()

      Answer the name of the superclass of this class. An interface has a null superclass name. The root class java.lang.Object has a null superclass name. All other classes have a non-null superclass name.

      Retrieval of the superclass name is preferred to retrieving the superclass object.

      Returns:
      The superclass name of this class. Null for interfaces and for java.lang.Object isInterface() getSuperclass()
    • getSuperclass

      ClassInfo getSuperclass()

      Answer the superclass of this class. An interface has a null superclass. The root class java.lang.Object has a null superclass. All other classes have a non-null superclass name.

      Retrieval of the superclass name is preferred to retrieving the superclass object.

      Returns:
      The superclass of this class. Null for interfaces and for java.lang.Object isInterface() getSuperclassName()
    • isAssignableFrom

      boolean isAssignableFrom(String className)

      Tell if a variable of this type can be assigned a value having a specified type, as specified by the name of the type.

      That is, is the type as represented by this class object coarser (the same or strictly coarser) than the specified type.

      Assignment tests are the reverse of instance-of tests. That is, if type X is assignable from type Y, then Y is an instance of X. Conversely, if Y is an instance of X, then X is assignable from Y.

      Parameters:
      className - The name of the type which is to be tested.
      Returns:
      True if a variable of this type can be assigned a value of the specified type. Otherwise, false. isInstanceOf(String) isInstanceOf(Class)
    • isInstanceOf

      boolean isInstanceOf(String className)

      Tell if this type is a sub-type of another type. The other type is specified by the name of the type.

      That is, is the type as represented by this class object finer (the same or strictly finer) than the specified type.

      Instance-of tests are the reverse of assignment tests. That is, if type X is an instance of type Y, then Y is assignable from of X. Conversely, if Y is assignable from X, then X is an instance of Y.

      Parameters:
      className - The name of the type which is to be tested.
      Returns:
      True if this type is an instance (sub-type) of the specified type. Otherwise, false. isAssignableFrom(String)
    • isInstanceOf

      boolean isInstanceOf(Class<?> clazz)
    • getDeclaredFields

      List<? extends FieldInfo> getDeclaredFields()

      Answer the declared fields of the receiver.

      The result collection does not support additions.

      Returns:
      The declared fields of the receiver. o
    • getDeclaredConstructors

      List<? extends MethodInfo> getDeclaredConstructors()

      Answer the declared constructors of the receiver.

      The result collection does not support additions.

      Returns:
      The declared constructors of the receiver.
    • getDeclaredMethods

      List<? extends MethodInfo> getDeclaredMethods()

      Answer the declared methods of the receiver.

      The result collection does not support additions.

      Returns:
      The declared methods of the receiver. getMethods()
    • getMethods

      List<? extends MethodInfo> getMethods()

      Answer the methods of the receiver. These are the methods, plus any acquired through inheritance.

      The result collection does not support additions.

      Returns:
      The methods of the receiver. getDeclaredFields()
    • isFieldAnnotationPresent

      boolean isFieldAnnotationPresent()

      Tell if this class object has an annotations on a field. (Annotations other than declared annotations are those which are added as a result of applications of JSR250.)

      Returns:
      True if any field of this class has an annotation. Otherwise, false. isMethodAnnotationPresent()
    • isMethodAnnotationPresent

      boolean isMethodAnnotationPresent()

      Tell if this class object has an annotations on a method. (Annotations other than declared annotations are those which are added as a result of applications of JSR250.)

      Returns:
      True if any method of this class has an annotation. Otherwise, false. isFieldAnnotationPresent()