fr.umlv.corosol.component
Class JPrimitiveClass

java.lang.Object
  extended by fr.umlv.corosol.component.JPrimitiveClass
All Implemented Interfaces:
JClass, JObject
Direct Known Subclasses:
BooleanClass, ByteClass, CharClass, DoubleClass, FloatClass, IntClass, LongClass, ShortClass, VoidClass

public abstract class JPrimitiveClass
extends java.lang.Object
implements JClass

This class represents the base class of primitive class implementations.

Author:
Christophe Deleray

Field Summary
static JClass BOOLEAN
          The JClass instance representing the primitive type boolean.
static JClass BYTE
          The JClass instance representing the primitive type byte.
static JClass CHAR
          The JClass instance representing the primitive type char.
static JClass DOUBLE
          The JClass instance representing the primitive type double.
static JClass FLOAT
          The JClass instance representing the primitive type float.
static JClass INT
          The JClass instance representing the primitive type int.
static JClass LONG
          The JClass instance representing the primitive type long.
static JClass SHORT
          The JClass instance representing the primitive type short.
static JClass VOID
          The JClass instance representing the primitive type void.
 
Fields inherited from interface fr.umlv.corosol.component.JClass
CATEGORY1, CATEGORY2
 
Method Summary
 JClassLoader getClassLoader()
          Returns the class loader of the class represented by this JClass object.
 JClass getComponentType()
          Returns the JClass representing the component type of an array.
 JConstantPool getConstantPool()
          Returns the constant pool of the class;
 JConstructor[] getDeclaredConstructors()
          Returns an array of JConstructor objects reflecting all the constructors declared by the class represented by this JClass object.
 JField getDeclaredField(java.lang.String name)
          Returns a JField object that reflects the specified declared field of the class or interface represented by this JClass object.
 JField[] getDeclaredFields()
          Returns an array of JField objects reflecting all the fields declared by the class or interface represented by this JClass object.
 JMethod[] getDeclaredMethods()
          Returns an array of JMethod objects reflecting all the methods declared by the class or interface represented by this JClass object.
 JClass[] getInterfaces()
          Determines the interfaces implemented by the class or interface represented by this object.
 int getModifiers()
          Returns the Java language modifiers for this class or interface, encoded in an integer.
 java.lang.String getName()
          Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this JClass object, as a String.
 JClass getSuperclass()
          Returns the JClass representing the superclass of the entity (class, interface, primitive type or void) represented by this Class.
 boolean isAbstract()
          Determines if the specified JClass object represents an abstract type.
 boolean isAnonymousClass()
          Determines if the specified JClass object represents an anonymous class.
 boolean isArray()
          Determines if this JClass object represents an array class.
 boolean isAssignableFrom(JClass c)
          Determines if the class or interface represented by this JClass object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified JClass parameter.
 boolean isInterface()
          Determines if the specified JClass object represents an interface type.
 boolean isJObject()
          Determines if the specified JClass object represents a Corosol JObject element.
 boolean isPrimitive()
          Determines if the specified JClass object represents a primitive type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.umlv.corosol.component.JClass
arrayCopy, copyValue, doGetfield, doGetstatic, doPutfield, doPutstatic, fieldCopy, getComputationalType, getNativeClass, pop, push
 

Field Detail

BOOLEAN

public static final JClass BOOLEAN
The JClass instance representing the primitive type boolean.


BYTE

public static final JClass BYTE
The JClass instance representing the primitive type byte.


CHAR

public static final JClass CHAR
The JClass instance representing the primitive type char.


DOUBLE

public static final JClass DOUBLE
The JClass instance representing the primitive type double.


FLOAT

public static final JClass FLOAT
The JClass instance representing the primitive type float.


INT

public static final JClass INT
The JClass instance representing the primitive type int.


LONG

public static final JClass LONG
The JClass instance representing the primitive type long.


SHORT

public static final JClass SHORT
The JClass instance representing the primitive type short.


VOID

public static final JClass VOID
The JClass instance representing the primitive type void.

Method Detail

isAssignableFrom

public boolean isAssignableFrom(JClass c)
Determines if the class or interface represented by this JClass object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified JClass parameter. It returns true if so; otherwise it returns false. If this JClass object represents a primitive type, this method returns true if the specified JClass parameter is exactly this JClass object; otherwise it returns false.

Specified by:
isAssignableFrom in interface JClass
Parameters:
c - the JClass object to be checked
Returns:
the boolean value indicating whether objects of the type c can be assigned to objects of this class

isInterface

public boolean isInterface()
Determines if the specified JClass object represents an interface type.

Specified by:
isInterface in interface JClass
Returns:
true if this object represents an interface; false otherwise.

isArray

public boolean isArray()
Determines if this JClass object represents an array class.

Specified by:
isArray in interface JClass
Returns:
true if this object represents an array class; false otherwise.

isPrimitive

public boolean isPrimitive()
Determines if the specified JClass object represents a primitive type.

Specified by:
isPrimitive in interface JClass
Returns:
true if and only if this class represents a primitive type; false otherwise.

isAnonymousClass

public boolean isAnonymousClass()
Determines if the specified JClass object represents an anonymous class.

Specified by:
isAnonymousClass in interface JClass
Returns:
true if and only if this class represents an anonymous class; false otherwise.

isJObject

public boolean isJObject()
Determines if the specified JClass object represents a Corosol JObject element.

Specified by:
isJObject in interface JClass
Returns:
true if and only if this class represents a Corosol JObject; false otherwise.

isAbstract

public boolean isAbstract()
Determines if the specified JClass object represents an abstract type.

Specified by:
isAbstract in interface JClass
Returns:
true if and only if this class represents an abstract type; false otherwise.

getName

public java.lang.String getName()
Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this JClass object, as a String.

Specified by:
getName in interface JClass
Returns:
the name of the class or interface represented by this object.

getSuperclass

public JClass getSuperclass()
Returns the JClass representing the superclass of the entity (class, interface, primitive type or void) represented by this Class. If this JClass represents either the Object class, an interface, a primitive type, or void, then null is returned. If this object represents an array class then the JClass object representing the Object class is returned.

Specified by:
getSuperclass in interface JClass
Returns:
the superclass of the class represented by this object.

getInterfaces

public JClass[] getInterfaces()
Determines the interfaces implemented by the class or interface represented by this object.

If this object represents a class, the return value is an array containing objects representing all interfaces implemented by the class. The order of the interface objects in the array corresponds to the order of the interface names in the implements clause of the declaration of the class represented by this object.

If this object represents an interface, the array contains objects representing all interfaces extended by the interface. The order of the interface objects in the array corresponds to the order of the interface names in the extends clause of the declaration of the interface represented by this object.

If this object represents a class or interface that implements no interfaces, the method returns an array of length 0.

If this object represents a primitive type or void, the method returns an array of length 0.

Specified by:
getInterfaces in interface JClass
Returns:
an array of interfaces implemented by this class.

getComponentType

public JClass getComponentType()
Returns the JClass representing the component type of an array. If this class does not represent an array class this method returns null.

Specified by:
getComponentType in interface JClass
Returns:
the JClass representing the component type of this class if this class is an array

getModifiers

public int getModifiers()
Returns the Java language modifiers for this class or interface, encoded in an integer. The modifiers consist of the Java Virtual Machine's constants for public, protected, private, final, static, abstract and interface; they should be decoded using the methods of class Modifier.

If the underlying class is an array class, then its public, private and protected modifiers are the same as those of its component type. If this Class represents a primitive type or void, its public modifier is always true, and its protected and private modifiers are always false. If this object represents an array class, a primitive type or void, then its final modifier is always true and its interface modifier is always false. The values of its other modifiers are not determined by this specification.

The modifier encodings are defined in The Java Virtual Machine Specification, table 4.1.

Specified by:
getModifiers in interface JClass
Returns:
the int representing the modifiers for this class
See Also:
Modifier

getDeclaredFields

public JField[] getDeclaredFields()
Returns an array of JField objects reflecting all the fields declared by the class or interface represented by this JClass object. This includes public, protected, default (package) access, and private fields, but excludes inherited fields. The elements in the array returned are not sorted and are not in any particular order. This method returns an array of length 0 if the class or interface declares no fields, or if this Class object represents a primitive type, an array class, or void.

See The Java Language Specification, sections 8.2 and 8.3.

Specified by:
getDeclaredFields in interface JClass
Returns:
the array of JField objects representing all the declared fields of this class

getDeclaredField

public JField getDeclaredField(java.lang.String name)
                        throws java.lang.NoSuchFieldException
Returns a JField object that reflects the specified declared field of the class or interface represented by this JClass object. The name parameter is a String that specifies the simple name of the desired field. Note that this method will not reflect the length field of an array class.

Specified by:
getDeclaredField in interface JClass
Parameters:
name - the name of the field
Returns:
the JField object for the specified field in this class
Throws:
java.lang.NoSuchFieldException - if a field with the specified name is not found.

getDeclaredMethods

public JMethod[] getDeclaredMethods()
Returns an array of JMethod objects reflecting all the methods declared by the class or interface represented by this JClass object. This includes public, protected, default (package) access, and private methods, but excludes inherited methods. The elements in the array returned are not sorted and are not in any particular order. This method returns an array of length 0 if the class or interface declares no methods, or if this Class object represents a primitive type, an array class, or void. The class initialization method <clinit> is not included in the returned array. If the class declares multiple public member methods with the same parameter types, they are all included in the returned array.

See The Java Language Specification, section 8.2.

Specified by:
getDeclaredMethods in interface JClass
Returns:
the array of JMethod objects representing all the declared methods of this class

getDeclaredConstructors

public JConstructor[] getDeclaredConstructors()
Returns an array of JConstructor objects reflecting all the constructors declared by the class represented by this JClass object. These are public, protected, default (package) access, and private constructors. The elements in the array returned are not sorted and are not in any particular order. If the class has a default constructor, it is included in the returned array. This method returns an array of length 0 if this JClass object represents an interface, a primitive type, an array class, or void.

See The Java Language Specification, section 8.2.

Specified by:
getDeclaredConstructors in interface JClass
Returns:
the array of JMethod objects representing all the declared constructors of this class

getConstantPool

public JConstantPool getConstantPool()
Returns the constant pool of the class;

Specified by:
getConstantPool in interface JClass

getClassLoader

public JClassLoader getClassLoader()
Returns the class loader of the class represented by this JClass object.

Specified by:
getClassLoader in interface JClass