|
|||||||||
| Home >> All >> openjava >> [ mop overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
openjava.mop
Class OJClass

java.lang.Objectopenjava.mop.OJClass
- All Implemented Interfaces:
- OJMember
- Direct Known Subclasses:
- Metaclass
- public class OJClass
- extends java.lang.Object
- implements OJMember
- extends java.lang.Object
The OJClass class represents a class metaobject. If
the class has its valid .class file in CLASSPATH, the metaobject can
behave like java.lang.Class. If the class has its
valid .oj file in the packages where some classes are being compiled
by OpenJava system, or in the packages explicitly specified by
something like OpenJava compiler option or environment variable, the
metaobject can have information about source code just as
stamements, expressions, and etc.
Additionaly, you can overrides the methods for introspection.
OJClass[] getDeclaredClasses()
OJMethod[] getDeclaredMethods()
OJField[] getDeclaredFields()
OJConstructor[] getDeclaredConstructors()
OJMethod getAcceptableMethod(OJClass,String,OJClass[])
OJMethod getAcceptableConstructor(OJClass,String,OJClass[])
- Since:
- $Id: OJClass.java,v 1.2 2003/02/19 02:55:01 tatsubori Exp $
- Version:
- 1.0
| Field Summary | |
private OJClassImp |
substance
|
| Fields inherited from interface openjava.mop.OJMember |
DECLARED, PUBLIC |
| Constructor Summary | |
(package private) |
OJClass()
For dummy type of null object. |
|
OJClass(java.lang.Class java_class,
MetaInfo metainfo)
Generates a metaobject from byte code. |
|
OJClass(Environment outer_env,
OJClass declarer,
openjava.ptree.ClassDeclaration ptree)
Generates a metaobject from source code. |
private |
OJClass(OJClass componentType)
For arrays |
| Method Summary | |
protected OJClass |
addClass(OJClass clazz)
|
protected OJConstructor |
addConstructor(OJConstructor constr)
|
OJField |
addField(OJField field)
|
protected void |
addInterface(OJClass clazz)
|
protected OJMethod |
addMethod(OJMethod method)
|
(package private) static OJClass[] |
arrayForClasses(java.lang.Class[] jclasses)
|
openjava.ptree.Expression |
expandAllocation(Environment env,
openjava.ptree.AllocationExpression expr)
|
openjava.ptree.Expression |
expandArrayAccess(Environment env,
openjava.ptree.ArrayAccess expr)
|
openjava.ptree.Expression |
expandArrayAllocation(Environment env,
openjava.ptree.ArrayAllocationExpression expr)
|
openjava.ptree.Expression |
expandAssignmentExpression(Environment env,
openjava.ptree.AssignmentExpression expr)
|
openjava.ptree.Expression |
expandCastedExpression(Environment env,
openjava.ptree.CastExpression decl)
|
openjava.ptree.Expression |
expandCastExpression(Environment env,
openjava.ptree.CastExpression decl)
|
openjava.ptree.Expression |
expandExpression(Environment env,
openjava.ptree.Expression expr)
|
openjava.ptree.Expression |
expandFieldRead(Environment env,
openjava.ptree.FieldAccess expr)
|
openjava.ptree.Expression |
expandFieldWrite(Environment env,
openjava.ptree.AssignmentExpression expr)
|
openjava.ptree.Expression |
expandMethodCall(Environment env,
openjava.ptree.MethodCall expr)
|
openjava.ptree.TypeName |
expandTypeName(Environment env,
openjava.ptree.TypeName expr)
|
openjava.ptree.Statement |
expandVariableDeclaration(Environment env,
openjava.ptree.VariableDeclaration decl)
|
static OJClass |
forClass(java.lang.Class javaClass)
Converts a OJClass object to an OJClass
object. |
static OJClass |
forName(java.lang.String name)
Returns the OJClass object associated with the class
with the given string name. |
static OJClass |
forParseTree(Environment env,
OJClass declaringClass,
openjava.ptree.ClassDeclaration ptree)
Converts ParseTree objects to an OJClass
object. |
OJConstructor |
getAcceptableConstructor(OJClass[] parameterTypes,
OJClass situation)
Can be overriden |
OJMethod |
getAcceptableMethod(java.lang.String name,
OJClass[] parameterTypes,
OJClass situation)
Can be overriden |
OJClass[] |
getAllClasses()
|
OJField |
getAllField(java.lang.String name)
Deprecated. |
OJField[] |
getAllFields()
|
OJMethod |
getAllMethod(java.lang.String name,
OJClass[] parameterTypes)
Deprecated. |
OJMethod[] |
getAllMethods()
|
OJMethod[] |
getAllMethods(java.lang.String name)
Deprecated. |
java.lang.Class |
getByteCode()
|
OJClass[] |
getClasses()
Returns an array containing OJClass objects
representing all the public classes and interfaces
that are members of the class represented by this
OJClass object. |
OJClass[] |
getClasses(OJClass situation)
Returns an array containing OJClass objects
representing all the classes and interfaces which are members
of the class represented by this OJClass object,
accessible from the situation represented by the given
OJClass object. |
java.lang.Class |
getCompatibleJavaClass()
|
OJClass |
getComponentType()
Returns the OJClass representing the component type of an
array. |
OJConstructor |
getConstructor(OJClass[] parameterTypes)
Returns a OJConstructor object that reflects the
specified public constructor of the class represented by this
OJClass object. |
OJConstructor |
getConstructor(OJClass[] parameterTypes,
OJClass situation)
Returns a OJConstructor object that reflects the
specified constructor accesible from the situation represented
by the given OJClass object. |
OJConstructor[] |
getConstructors()
Returns an array containing OJConstructor objects
reflecting all the public constructors of the class
represented by this OJClass object. |
OJConstructor[] |
getConstructors(OJClass situation)
Returns an array containing OJConstructor objects
reflecting all the constructors of the class represented by
this OJClass object, accesible from the situation
represented by the given OJClass object. |
OJClass[] |
getDeclaredClasses()
Returns an array of OJClass objects reflecting all
the classes and interfaces declared as members of the class
represented by this OJClass object. |
OJConstructor |
getDeclaredConstructor(OJClass[] parameterTypes)
Returns a OJConstructor object that reflects the
specified constructor of the class or interface represented by
this OJClass object. |
OJConstructor[] |
getDeclaredConstructors()
Returns an array of OJConstructor objects reflecting
all the constructors declared by the class represented by this
OJClass object. |
OJField |
getDeclaredField(java.lang.String name)
Returns a OJField object that reflects the specified
declared field of the class or interface represented by this
OJClass object. |
OJField[] |
getDeclaredFields()
Returns an array of OJField objects reflecting all
the fields declared by the class or interface represented by
this OJClass object. |
OJMethod |
getDeclaredMethod(java.lang.String name,
OJClass[] parameterTypes)
Returns a OJMethod object that reflects the
specified declared method of the class or interface represented
by this OJClass object. |
OJMethod[] |
getDeclaredMethods()
Returns an array of OJMethod objects reflecting all
the methods declared by the class or interface represented by
this OJClass object. |
OJClass |
getDeclaringClass()
If the class or interface represented by this OJClass object is a member of another class,
returns the OJClass object representing the class
in which it was declared. |
static openjava.syntax.SyntaxRule |
getDeclSuffixRule(java.lang.String keyword)
|
Environment |
getEnvironment()
Obtains an environment of this class object. |
OJField |
getField(java.lang.String name)
Returns a OJField object that reflects the
specified public member field of the class or
interface represented by this OJClass object. |
OJField |
getField(java.lang.String name,
OJClass situation)
Returns a OJField object that reflects the
specified member field accesible from the situation represented
by the given OJClass object. |
OJField[] |
getFields()
Returns an array containing OJField objects
reflecting all the accessible public fields of the
class or interface represented by this OJClass
object. |
OJField[] |
getFields(OJClass situation)
Returns an array containing OJField objects
reflecting all the fields of the class or interface represented
by this OJClass object, accessible from the
situation represented by the given OJClass object. |
OJClass[] |
getInheritableClasses()
Deprecated. |
OJClass[] |
getInheritableClasses(OJClass situation)
|
OJConstructor[] |
getInheritableConstructors(OJClass situation)
|
OJField[] |
getInheritableFields()
Deprecated. |
OJField[] |
getInheritableFields(OJClass situation)
|
OJMethod[] |
getInheritableMethods()
Deprecated. |
OJMethod[] |
getInheritableMethods(OJClass situation)
|
OJClass[] |
getInheritedClasses()
|
OJField[] |
getInheritedFields()
|
OJMethod[] |
getInheritedMethods()
|
OJClass[] |
getInterfaces()
Determines the interfaces implemented by the class or interface represented by this object. |
java.lang.String |
getMetaInfo(java.lang.String key)
|
java.util.Enumeration |
getMetaInfoElements()
|
java.util.Enumeration |
getMetaInfoKeys()
|
OJMethod |
getMethod(java.lang.String name,
OJClass[] parameterTypes)
Returns a OJMethod object that reflects the
specified public member method of the class or interface
represented by this OJClass object. |
OJMethod |
getMethod(java.lang.String name,
OJClass[] parameterTypes,
OJClass situation)
Returns a OJMethod object that reflects the
specified member method accesible from the situation
represented by the given OJClass object. |
OJMethod[] |
getMethods()
Returns an array containing OJMethod objects
reflecting all the public member methods of the class
or interface represented by this OJClass object,
including those declared by the class or interface and and
those inherited from superclasses and superinterfaces. |
OJMethod[] |
getMethods(OJClass situation)
Returns an array containing OJMethod objects
reflecting all the member methods of the class or interface
represented by this OJClass object, accesible from
the situation represented by the given OJClass
object. |
OJModifier |
getModifiers()
Returns the Java language modifiers and the user defined modifiers for this class or interface, as a OJModifier object. |
java.lang.String |
getName()
Returns the fully-qualified name of the entity (class, interface, array class, primitive type, or void) represented by this OJClass object, as a String. |
java.lang.String |
getPackage()
Gets the package name for this class as a String. |
java.lang.String |
getSimpleName()
Returns the simple name of the class, interface or array class represented by this OJClass object, as a
String. |
openjava.ptree.ClassDeclaration |
getSourceCode()
|
openjava.ptree.ParseTree |
getSuffix(java.lang.String keyword)
Obtains an parse tree of suffix in extended syntax starting with the specified keyword. |
OJClass |
getSuperclass()
Returns the OJClass representing the superclass of
the entity (class, interface, primitive type or void)
represented by this OJClass. |
static openjava.syntax.SyntaxRule |
getTypeSuffixRule(java.lang.String keyword)
|
boolean |
isAlterable()
|
boolean |
isArray()
Determines if this OJClass object represents an
array class. |
private static boolean |
isArrayName(java.lang.String name)
|
boolean |
isAssignableFrom(OJClass clazz)
Determines if the class or interface represented by this OJClass object is either the same as, or is a
superclass or superinterface of, the class or interface
represented by the specified OJClass parameter. |
boolean |
isExecutable()
|
boolean |
isInSamePackage(OJClass c)
Determines if the specified class object is in the same package as this class object. |
boolean |
isInterface()
Determines if the specified OJClass object represents
an interface type. |
boolean |
isPrimitive()
Determines if the specified OJClass object represents a
primitive type. |
boolean |
isPrimitiveWrapper()
Determines if the specified OJClass object represents a
wrapper class for a primitive type. |
static boolean |
isRegisteredKeyword(java.lang.String keyword)
|
static boolean |
isRegisteredModifier(java.lang.String keyword)
|
private static OJClass |
lookupFromByteCode(java.lang.String name)
|
private static OJClass |
lookupFromMetaInfo(java.lang.Class javaClass)
|
OJClass |
makeCopy(java.lang.String qname)
Generate a copy of this class object with the specified name. |
protected static openjava.ptree.Expression |
makeExpression(Environment env,
java.lang.String str)
Generates a expression parse tree from a given String object under the given environment. |
protected openjava.ptree.Expression |
makeExpression(java.lang.String str)
Generates an expression parse tree from a given String object under the environment of
this class object. |
protected static openjava.ptree.Statement |
makeStatement(Environment env,
java.lang.String str)
Generates a statement parse tree from a given String object under the given environment. |
protected openjava.ptree.Statement |
makeStatement(java.lang.String str)
Generates a statement parse tree from a given String object under the environment of
this class object. |
protected static openjava.ptree.StatementList |
makeStatementList(Environment env,
java.lang.String str)
Generates a statement list parse tree from a given String object under the given environment. |
protected openjava.ptree.StatementList |
makeStatementList(java.lang.String str)
Generates a statement list parse tree from a given String object under the environment of
this class object. |
private static java.lang.String |
nameForJavaClassName(java.lang.String jcname)
|
private static java.lang.String |
nameToJavaClassName(java.lang.String ojcname)
|
private static OJClass[] |
overridesOn(OJClass[] declareds,
OJClass[] bases)
|
private static OJField[] |
overridesOn(OJField[] declareds,
OJField[] bases)
|
private static OJMethod[] |
overridesOn(OJMethod[] declareds,
OJMethod[] bases)
|
private static OJConstructor |
pickupAcceptableConstructor(OJConstructor[] src_constrs,
OJClass[] parameterTypes)
|
private static OJMethod |
pickupAcceptableMethod(OJMethod[] src_methods,
java.lang.String name,
OJClass[] parameterTypes)
|
private static OJConstructor |
pickupConstructor(OJConstructor[] src_constrs,
OJClass[] parameterTypes)
|
private static OJField |
pickupField(OJField[] src_fields,
java.lang.String name)
|
private static OJMethod |
pickupMethod(OJMethod[] src_methods,
java.lang.String name,
OJClass[] parameterTypes)
|
private static OJMethod[] |
pickupMethodsByName(OJMethod[] src_methods,
java.lang.String name)
|
private static int |
primitiveTypeWidth(OJClass ptype)
|
OJClass |
primitiveWrapper()
Obtains the wrapper class if this class represents a primitive type. |
protected java.lang.String |
putMetaInfo(java.lang.String key,
java.lang.String value)
|
protected OJClass |
removeClass(OJClass clazz)
|
protected OJConstructor |
removeConstructor(OJConstructor constr)
|
OJField |
removeField(OJField field)
|
protected OJMethod |
removeMethod(OJMethod method)
|
private static OJClass[] |
removeTheDefaults(OJClass[] src_classes)
|
private static OJConstructor[] |
removeTheDefaults(OJConstructor[] src_constrs)
|
private static OJField[] |
removeTheDefaults(OJField[] src_fields)
|
private static OJMethod[] |
removeTheDefaults(OJMethod[] src_methods)
|
private static OJClass[] |
removeTheNonPublics(OJClass[] src_classes)
|
private static OJConstructor[] |
removeTheNonPublics(OJConstructor[] src_constrs)
|
private static OJField[] |
removeTheNonPublics(OJField[] src_fields)
|
private static OJMethod[] |
removeTheNonPublics(OJMethod[] src_methods)
|
private static OJClass[] |
removeThePrivates(OJClass[] src_classes)
|
private static OJConstructor[] |
removeThePrivates(OJConstructor[] src_constrs)
|
private static OJField[] |
removeThePrivates(OJField[] src_fields)
|
private static OJMethod[] |
removeThePrivates(OJMethod[] src_methods)
|
private static java.lang.String |
replaceDotWithDoller(java.lang.String base,
int i)
|
OJField |
resolveException(NoSuchMemberException e,
java.lang.String name)
|
OJMethod |
resolveException(NoSuchMemberException e,
java.lang.String name,
OJClass[] argtypes)
|
(package private) void |
setDeclaringClass(OJClass parent)
|
protected OJClass[] |
setInterfaces(OJClass[] classes)
|
protected java.lang.String |
setName(java.lang.String simple_name)
not implemented yet |
protected OJClass |
setSuperclass(OJClass clazz)
|
Signature |
signature()
|
private static java.lang.String |
stripBrackets(java.lang.String ojcname)
|
(package private) static java.lang.Class[] |
toClasses(OJClass[] classes)
|
java.lang.String |
toString()
Converts the object to a string. |
void |
translateDefinition()
|
openjava.ptree.ClassDeclaration |
translateDefinition(Environment env,
openjava.ptree.ClassDeclaration decl)
|
OJClass |
unwrappedPrimitive()
Obtains the real type class if this class represents a primitive wrapper type. |
void |
waitTranslation(OJClass clazz)
Waits a callee-side translation on another class metaobject to be done. |
void |
writeMetaInfo(java.io.Writer out)
inner use only |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
substance
private OJClassImp substance
| Constructor Detail |
OJClass
public OJClass(Environment outer_env, OJClass declarer, openjava.ptree.ClassDeclaration ptree)
- Generates a metaobject from source code.
This constructor will be invoked by the OpenJava system. In inheriting this class, you must call this consturctor from a constructor with the same signature in your class.
For example, in defining a subclass
YourClassderived from this class, at least you have to write as follows:public YourClass( Environment outer_env, OJClass declarer, ClassDeclaration ptree ) { super( outer_env, declarer, ptree ); }
OJClass
public OJClass(java.lang.Class java_class, MetaInfo metainfo)
- Generates a metaobject from byte code.
This constructor will be invoked only by the OpenJava system. In inheriting this class, you must call this consturctor from a constructor with the same signature in your class.
For example, in defining a subclass
YourClassderived from this class, at least you have to write as follows:public YourClass( Class java_class, MetaInfo metainfo ) { super( java_class, metainfo ); }
OJClass
private OJClass(OJClass componentType)
- For arrays
OJClass
OJClass()
- For dummy type of null object.
This should be called only once by OJSystem.initConstants().
| Method Detail |
forName
public static OJClass forName(java.lang.String name) throws OJClassNotFoundException
- Returns the
OJClassobject associated with the class with the given string name. Given the fully-qualified name for a class or interface, this method attempts to locate, load and link the class. If it succeeds, returns the Class object representing the class. If it fails, the method throws a OJClassNotFoundException.For example, the following code fragment returns the runtime
OJClassdescriptor for the class namedjava.lang.Thread:OJClass t = OJClass.forName( "java.lang.Thread" );
lookupFromByteCode
private static final OJClass lookupFromByteCode(java.lang.String name)
replaceDotWithDoller
private static final java.lang.String replaceDotWithDoller(java.lang.String base, int i)
isArrayName
private static final boolean isArrayName(java.lang.String name)
stripBrackets
private static final java.lang.String stripBrackets(java.lang.String ojcname)
nameForJavaClassName
private static final java.lang.String nameForJavaClassName(java.lang.String jcname)
nameToJavaClassName
private static final java.lang.String nameToJavaClassName(java.lang.String ojcname)
arrayForClasses
static OJClass[] arrayForClasses(java.lang.Class[] jclasses)
toClasses
static java.lang.Class[] toClasses(OJClass[] classes)
forClass
public static OJClass forClass(java.lang.Class javaClass)
- Converts a
OJClassobject to anOJClassobject.This method returns the same
OJClassobject whenever it is invoked for the sameClassobject. It gurantees one-to-one correspondence betweenClassandOJClass.
lookupFromMetaInfo
private static final OJClass lookupFromMetaInfo(java.lang.Class javaClass)
forParseTree
public static OJClass forParseTree(Environment env, OJClass declaringClass, openjava.ptree.ClassDeclaration ptree) throws AmbiguousClassesException, java.lang.ClassNotFoundException
- Converts
ParseTreeobjects to anOJClassobject. The generatedOJClassobject is to be registered as globally asscessible class but not to appear as generated source code.
makeExpression
protected static final openjava.ptree.Expression makeExpression(Environment env, java.lang.String str) throws MOPException
- Generates a expression parse tree from a given
Stringobject under the given environment.
makeExpression
protected final openjava.ptree.Expression makeExpression(java.lang.String str) throws MOPException
- Generates an expression parse tree from a given
Stringobject under the environment of this class object.
makeStatement
protected static final openjava.ptree.Statement makeStatement(Environment env, java.lang.String str) throws MOPException
- Generates a statement parse tree from a given
Stringobject under the given environment.
makeStatement
protected final openjava.ptree.Statement makeStatement(java.lang.String str) throws MOPException
- Generates a statement parse tree from a given
Stringobject under the environment of this class object.
makeStatementList
protected static final openjava.ptree.StatementList makeStatementList(Environment env, java.lang.String str) throws MOPException
- Generates a statement list parse tree from a given
Stringobject under the given environment.
makeStatementList
protected final openjava.ptree.StatementList makeStatementList(java.lang.String str) throws MOPException
- Generates a statement list parse tree from a given
Stringobject under the environment of this class object.
toString
public java.lang.String toString()
- Converts the object to a string. The string representation is
the string "class" or "interface", followed by a space, and then
by the fully qualified name of the class in the format returned
by
getName. If thisOJClassobject represents a primitive type, this method returns the name of the primitive type. If thisOJClassobject represents void this method returns "void".
getEnvironment
public Environment getEnvironment()
- Obtains an environment of this class object.
This environment has information about members and outr
environments such as packages but not local information like
local variable in methods of this class.
- Specified by:
getEnvironmentin interfaceOJMember
isAssignableFrom
public boolean isAssignableFrom(OJClass clazz)
- Determines if the class or interface represented by this
OJClassobject is either the same as, or is a superclass or superinterface of, the class or interface represented by the specifiedOJClassparameter. It returnstrueif so; otherwise it returnsfalse. If thisOJClassobject represents a primitive type, this method returnstrueif the type represented by thisOJClassobject can accept the type represented by the specifiedOJClassparameter; otherwise it returnsfalse.Specifically, this method tests whether the type represented by the specified
OJClassparameter can be converted to the type represented by thisOJClassobject via an identity conversion or via a widening reference/primitive conversion.The behavior about primitive types is different from the method of the same name of
java.lang.Class.
primitiveTypeWidth
private static int primitiveTypeWidth(OJClass ptype)
isInterface
public boolean isInterface()
- Determines if the specified
OJClassobject represents an interface type.
isArray
public boolean isArray()
- Determines if this
OJClassobject represents an array class.
isPrimitive
public boolean isPrimitive()
- Determines if the specified
OJClassobject represents a primitive type.There are nine predefined
OJClassobjects to represent the eight primitive types and void. These are created by the Java Virtual Machine, and have the same names as the primitive types that they represent, namelyboolean,byte,char,short,int,long,float, anddouble.These objects may be accessed via the following public static final variables, and are the only
OJClassobjects for which this method returnstrue.
isPrimitiveWrapper
public boolean isPrimitiveWrapper()
- Determines if the specified
OJClassobject represents a wrapper class for a primitive type.
primitiveWrapper
public OJClass primitiveWrapper()
- Obtains the wrapper class if this class represents a primitive
type.
For example this method returns java.lang.Integer for int.
unwrappedPrimitive
public OJClass unwrappedPrimitive()
- Obtains the real type class if this class represents a primitive
wrapper type.
For example this method returns int for java.lang.Integer.
getName
public java.lang.String getName()
- Returns the fully-qualified name of the entity (class,
interface, array class, primitive type, or void) represented by
this
OJClassobject, as aString.If this
OJClassobject represents a class of arrays, then the internal form of the name consists of the name of the element type in Java signature format, followed by one or more "[]" characters representing the depth of array nesting. This representation differs from that ofjava.lang.Class.forName(). Thus:
returns "OJClass.forClass( (new int[3][4]).getClass() ).getName()
java.lang.Object[]" and:
returns "OJClass.forClass( (new int[3][4]).getClass() ).getName()
int[][]".The class or interface name classname is given in fully qualified form as shown in the example above.
getSimpleName
public java.lang.String getSimpleName()
- Returns the simple name of the class, interface or array class
represented by this
OJClassobject, as aString. Thus:
returns "OJClass.forClass( (new Object[3]).getClass() ).getName()
Object".
getPackage
public java.lang.String getPackage()
- Gets the package name for this class as a
String. Null is returned if its package was not specified in source code of this class.
isInSamePackage
public boolean isInSamePackage(OJClass c)
- Determines if the specified class object is in the same package
as this class object.
If null is given, this method returns alway false.
getSuperclass
public OJClass getSuperclass()
- Returns the
OJClassrepresenting the superclass of the entity (class, interface, primitive type or void) represented by thisOJClass. If thisOJClassrepresents either thejava.lang.Objectclass, an interface, a primitive type, or void, then null is returned. If this object represents an array class then theOJClassobject representing thejava.lang.Objectclass is returned.
getInterfaces
public OJClass[] 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
implementsclause of the declaration of the class represented by this object. For example, given the declaration:
suppose the value ofclass Shimmer implements FloorWax, DessertTopping { ... }clazzis an class object for the classShimmer; the value of the expression:
is theclazz.getInterfaces()[0]
OJClassobject that represents interfaceFloorWax; and the value of:
is theclazz.getInterfaces()[1]
OJClassobject that represents interfaceDessertTopping.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
extendsclause 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.
To be
getDeclaredInterfaces().
getComponentType
public OJClass getComponentType()
- Returns the
OJClassrepresenting the component type of an array. If this class does not represent an array class this method returns null.
getModifiers
public OJModifier getModifiers()
- Returns the Java language modifiers and the user defined modifiers
for this class or interface, as a
OJModifierobject.If the underlying class is an array class, then its
public,privateandprotectedmodifiers are the same as those of its component type. If thisOJClassrepresents a primitive type or void, itspublicmodifier is alwaystrue, and itsprotectedandprivatemodifers are alwaysfalse. If this object represents an array class, a primitive type or void, then itsfinalmodifier is alwaystrueand its interface modifer is alwaysfalse. The values of its other modifiers are not determined by this specification.- Specified by:
getModifiersin interfaceOJMember
getSuffix
public openjava.ptree.ParseTree getSuffix(java.lang.String keyword)
- Obtains an parse tree of suffix in extended syntax starting
with the specified keyword. Returned
openjava.ptree.ParseTreeobject has a structure built by anopenjava.syntax.SyntaxRuleobject returned via the methodgetDeclSuffixRule(String).
getDeclaringClass
public OJClass getDeclaringClass()
- If the class or interface represented by this
OJClassobject is a member of another class, returns theOJClassobject representing the class in which it was declared. This method returns null if this class or interface is not a member of any other class. If thisOJClassobject represents an array class, a primitive type, or void, then this method returns null.- Specified by:
getDeclaringClassin interfaceOJMember
getAllClasses
public final OJClass[] getAllClasses()
getAllFields
public final OJField[] getAllFields()
getAllMethods
public final OJMethod[] getAllMethods()
getInheritedClasses
public OJClass[] getInheritedClasses()
getInheritedFields
public OJField[] getInheritedFields()
getInheritedMethods
public final OJMethod[] getInheritedMethods()
getInheritableClasses
public final OJClass[] getInheritableClasses()
- Deprecated.
- Use
getInheritableClasses(OJClass) - Use
getInheritableFields
public final OJField[] getInheritableFields()
- Deprecated.
- Use
getInheritableFields(OJClass) - Use
getInheritableMethods
public final OJMethod[] getInheritableMethods()
- Deprecated.
- Use
getInheritableMethods(OJClass) - Use
getInheritableClasses
public OJClass[] getInheritableClasses(OJClass situation)
getInheritableFields
public OJField[] getInheritableFields(OJClass situation)
getInheritableMethods
public OJMethod[] getInheritableMethods(OJClass situation)
getInheritableConstructors
public OJConstructor[] getInheritableConstructors(OJClass situation)
overridesOn
private static final OJClass[] overridesOn(OJClass[] declareds, OJClass[] bases)
overridesOn
private static final OJField[] overridesOn(OJField[] declareds, OJField[] bases)
overridesOn
private static final OJMethod[] overridesOn(OJMethod[] declareds, OJMethod[] bases)
removeThePrivates
private static final OJClass[] removeThePrivates(OJClass[] src_classes)
removeThePrivates
private static final OJField[] removeThePrivates(OJField[] src_fields)
removeThePrivates
private static final OJMethod[] removeThePrivates(OJMethod[] src_methods)
removeThePrivates
private static final OJConstructor[] removeThePrivates(OJConstructor[] src_constrs)
removeTheDefaults
private static final OJClass[] removeTheDefaults(OJClass[] src_classes)
removeTheDefaults
private static final OJField[] removeTheDefaults(OJField[] src_fields)
removeTheDefaults
private static final
JAVADOC
openjava.mop.OJClass