net.janino
Class IClass

java.lang.Object
  |
  +--net.janino.IClass
Direct Known Subclasses:
ClassFileIClass, Java.ClassOrInterfaceDeclaration

public abstract class IClass
extends java.lang.Object

A simplified equivalent to "java.lang.reflect".


Inner Class Summary
 class IClass.IConstructor
           
 class IClass.IField
           
 class IClass.IInvocable
           
 class IClass.IMember
           
 class IClass.IMethod
           
 
Field Summary
static int PACKAGE
          Return value for IClass.IMember.getAccess().
static int PRIVATE
          Return value for IClass.IMember.getAccess().
static int PROTECTED
          Return value for IClass.IMember.getAccess().
static int PUBLIC
          Return value for IClass.IMember.getAccess().
 
Constructor Summary
IClass()
           
 
Method Summary
static IClass createArrayIClass(IClass componentType, IClass objectType)
          Create an IClass that represents an array of the given component type.
abstract  IClass getComponentType()
          Returns the component type of the array.
Returns "null" for classes, interfaces, primitive types and "void".
abstract  IClass[] getDeclaredIClasses()
          Returns the classes and interfaces declared as members of the class (but not inherited classes and interfaces).
Returns an empty array for an array, primitive type or "void".
abstract  IClass.IConstructor[] getDeclaredIConstructors()
          Returns all the constructors declared by the class represented by the type.
abstract  IClass.IField[] getDeclaredIFields()
          Returns the fields of a class or interface (but not inherited fields).
Returns an empty array for an array, primitive type or "void".
abstract  IClass.IMethod[] getDeclaredIMethods()
          Returns the methods of the class or interface (but not inherited methods).
Returns an empty array for an array, primitive type or "void".
abstract  java.lang.String getDescriptor()
          Returns the field descriptor for the type as defined by JVMS 4.3.2.
abstract  IClass[] getInterfaces()
          Returns the interfaces implemented by the class.
Returns the superinterfaces of the interface.
Returns "Cloneable" and "Serializable" for arrays.
Returns an empty array for primitive types and "void".
abstract  IClass getSuperclass()
          Returns the superclass of the class.
Returns "null" for class "Object", interfaces, arrays, primitive types and "void".
 boolean implementsInterface(IClass that)
          If this represents a class: Return true if this class directly or indirectly implements that interface.
abstract  boolean isAbstract()
          Whether the class may be instantiated (JVMS 4.1 access_flags)
abstract  boolean isArray()
          Returns "true" if this type represents an array.
 boolean isAssignableFrom(IClass that)
          Determine if "this" is assignable from "that".
abstract  boolean isFinal()
          Whether subclassing is allowed (JVMS 4.1 access_flags)
abstract  boolean isInterface()
          Returns "true" if this type represents an interface.
abstract  boolean isPrimitive()
          Returns "true" if this type represents a primitive type or "void".
abstract  boolean isPrimitiveNumeric()
          Returns "true" if this type represents "byte", "short", "int", "long", "char", "float" or "double".
abstract  boolean isPublic()
          Whether the class may be accessed from outside its package (JVMS 4.1 access_flags)
 boolean isSubclassOf(IClass that)
          Returns true if this class is an immediate or non-immediate subclass of that class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIVATE

public static final int PRIVATE
Return value for IClass.IMember.getAccess().

PROTECTED

public static final int PROTECTED
Return value for IClass.IMember.getAccess().

PACKAGE

public static final int PACKAGE
Return value for IClass.IMember.getAccess().

PUBLIC

public static final int PUBLIC
Return value for IClass.IMember.getAccess().
Constructor Detail

IClass

public IClass()
Method Detail

getDeclaredIConstructors

public abstract IClass.IConstructor[] getDeclaredIConstructors()
Returns all the constructors declared by the class represented by the type. If the class has a default constructor, it is included.
Returns an empty array for an interface, array, primitive type or "void".

getDeclaredIMethods

public abstract IClass.IMethod[] getDeclaredIMethods()
Returns the methods of the class or interface (but not inherited methods).
Returns an empty array for an array, primitive type or "void".

getDeclaredIFields

public abstract IClass.IField[] getDeclaredIFields()
Returns the fields of a class or interface (but not inherited fields).
Returns an empty array for an array, primitive type or "void".

getDeclaredIClasses

public abstract IClass[] getDeclaredIClasses()
Returns the classes and interfaces declared as members of the class (but not inherited classes and interfaces).
Returns an empty array for an array, primitive type or "void".

getSuperclass

public abstract IClass getSuperclass()
                              throws Java.CompileException
Returns the superclass of the class.
Returns "null" for class "Object", interfaces, arrays, primitive types and "void".

isPublic

public abstract boolean isPublic()
Whether the class may be accessed from outside its package (JVMS 4.1 access_flags)

isFinal

public abstract boolean isFinal()
Whether subclassing is allowed (JVMS 4.1 access_flags)
Returns:
true if subclassing is prohibited

getInterfaces

public abstract IClass[] getInterfaces()
                                throws Java.CompileException
Returns the interfaces implemented by the class.
Returns the superinterfaces of the interface.
Returns "Cloneable" and "Serializable" for arrays.
Returns an empty array for primitive types and "void".

isAbstract

public abstract boolean isAbstract()
Whether the class may be instantiated (JVMS 4.1 access_flags)
Returns:
true if instantiation is prohibited

getDescriptor

public abstract java.lang.String getDescriptor()
Returns the field descriptor for the type as defined by JVMS 4.3.2.

isInterface

public abstract boolean isInterface()
Returns "true" if this type represents an interface.

isArray

public abstract boolean isArray()
Returns "true" if this type represents an array.

isPrimitive

public abstract boolean isPrimitive()
Returns "true" if this type represents a primitive type or "void".

isPrimitiveNumeric

public abstract boolean isPrimitiveNumeric()
Returns "true" if this type represents "byte", "short", "int", "long", "char", "float" or "double".

getComponentType

public abstract IClass getComponentType()
Returns the component type of the array.
Returns "null" for classes, interfaces, primitive types and "void".

isAssignableFrom

public boolean isAssignableFrom(IClass that)
                         throws Java.CompileException
Determine if "this" is assignable from "that". This is true if "this" is identical with "that", or if "this" is assignable from "that"'s superclass (if any), or if "this" is assignable from any of the interfaces which "that" implements.

isSubclassOf

public boolean isSubclassOf(IClass that)
                     throws Java.CompileException
Returns true if this class is an immediate or non-immediate subclass of that class.

implementsInterface

public boolean implementsInterface(IClass that)
                            throws Java.CompileException
If this represents a class: Return true if this class directly or indirectly implements that interface.

If this represents an interface: Return true if this interface directly or indirectly extends that interface.


createArrayIClass

public static IClass createArrayIClass(IClass componentType,
                                       IClass objectType)
Create an IClass that represents an array of the given component type.
Parameters:
componentType -  
objectType - Required because the superclass of an array class is java.lang.Object by definition