Interface ClassInfo

  • All Superinterfaces:
    Info

    public interface ClassInfo
    extends Info

    Info type used to represent a class.

    • Field Detail

      • OBJECT_CLASS_NAME

        static final java.lang.String OBJECT_CLASS_NAME

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

        See Also:
        Constant Field Values
      • SERIALIZABLE_CLASS_NAME

        static final java.lang.String SERIALIZABLE_CLASS_NAME

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

        See Also:
        Constant Field Values
      • EXTERNALIZABLE_CLASS_NAME

        static final java.lang.String EXTERNALIZABLE_CLASS_NAME

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

        See Also:
        Constant Field Values
      • REMOTE_EXCEPTION_CLASS_NAME

        static final java.lang.String REMOTE_EXCEPTION_CLASS_NAME

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

        See Also:
        Constant Field Values
      • EJB_EXCEPTION_CLASS_NAME

        static final java.lang.String EJB_EXCEPTION_CLASS_NAME

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

        See Also:
        Constant Field Values
    • Method Detail

      • 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.
        See Also:
        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.
        See Also:
        isDelayedClass()
      • getPackageName

        java.lang.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.
        See Also:
        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.
        See Also:
        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

        java.util.List<java.lang.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.
        See Also:
        #getInterfaceNamesArray(), getInterfaces(), #getAllInterfaceNames(), #getAllInterfaces()
      • getInterfaces

        java.util.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.
        See Also:
        #getInterfaceNamesArray(), getInterfaceNames(), #getAllInterfaceNames(), #getAllInterfaces()
      • 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

        java.lang.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
        See Also:
        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
        See Also:
        isInterface(), getSuperclassName()
      • isAssignableFrom

        boolean isAssignableFrom​(java.lang.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:
        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.
        See Also:
        #isAssignableFrom(ClassInfo), #isAssignableFrom(Class), isInstanceOf(String), #isInstanceOf(ClassInfo), isInstanceOf(Class)
      • isInstanceOf

        boolean isInstanceOf​(java.lang.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:
        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.
        See Also:
        isAssignableFrom(String), #isAssignableFrom(ClassInfo), #isAssignableFrom(Class)
      • isInstanceOf

        boolean isInstanceOf​(java.lang.Class<?> clazz)
      • getDeclaredFields

        java.util.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.
        See Also:
        #getFields()
      • getDeclaredConstructors

        java.util.List<? extends MethodInfo> getDeclaredConstructors()

        Answer the declared constructors of the receiver.

        The result collection does not support additions.

        Note: The difference between #getDeclaredConstructor() and #getConstructors() is not clear, as constructors are not inherited.

        Returns:
        The declared constructors of the receiver.
        See Also:
        #getConstructors()
      • getDeclaredMethods

        java.util.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.
        See Also:
        getMethods()
      • getMethods

        java.util.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.
        See Also:
        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.
        See Also:
        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.
        See Also:
        isFieldAnnotationPresent()