openjava.mop
Class Metaclass
java.lang.Object
|
+--openjava.mop.OJClass
|
+--openjava.mop.Metaclass
- public class Metaclass
- extends OJClass
The class Metaclass
is a metametaclass for metaclasses.
You can write a metaclass easily using this class.
For example,
public class MyClass instantiates Metaclass extends OJClass
{
convenient void f() {
.. String.class ..;
.. oldjavaclass.String.class ..;
}
void g() {
.. String.class ..;
}
}
Here, you don't have to write constructors if your program don't
concern. And class literal doesn't represent java.lang.Class
object but openjava.mop.OJClass.
The above code is to be translated into:
public class MyClass instantiates Metaclass extends OJClass
{
void f() {
.. openjava.mop.OJClass.forClass( String.class ) ..;
.. java.lang.String.class ..;
}
void g() {
.. java.lang.String.class ..;
}
void translateDefinition() {
OJClass c1 = openjava.mop.OJClass.forClass( String.class );
OJClass c2 = String.class;
}
public MyClass(Environment e, OJClass d, ClassDeclaration p) {
super(e,d,p);
}
public MyClass(Class c, MetaInfo m) {
super(c,m);
}
}
- Since:
- %SOFTWARE% 1.0
- See Also:
Object
Methods inherited from class openjava.mop.OJClass |
addClass,
addConstructor,
addField,
addInterface,
addMethod,
expandAllocation,
expandArrayAccess,
expandArrayAllocation,
expandAssignmentExpression,
expandCastedExpression,
expandCastExpression,
expandExpression,
expandFieldRead,
expandFieldWrite,
expandMethodCall,
expandTypeName,
expandVariableDeclaration,
forClass,
forName,
forObject,
forParseTree,
getAcceptableConstructor,
getAcceptableMethod,
getAllClasses,
getAllField,
getAllFields,
getAllMethod,
getAllMethods,
getAllMethods,
getByteCode,
getClasses,
getClasses,
getClassLoader,
getCompatibleJavaClass,
getComponentType,
getConstructor,
getConstructor,
getConstructors,
getConstructors,
getDeclaredClasses,
getDeclaredConstructor,
getDeclaredConstructors,
getDeclaredField,
getDeclaredFields,
getDeclaredMethod,
getDeclaredMethods,
getDeclaringClass,
getDeclSuffixRule,
getEnvironment,
getField,
getField,
getFields,
getFields,
getInheritableClasses,
getInheritableClasses,
getInheritableConstructors,
getInheritableFields,
getInheritableFields,
getInheritableMethods,
getInheritableMethods,
getInheritedClasses,
getInheritedFields,
getInheritedMethods,
getInterfaces,
getMetaInfo,
getMetaInfoElements,
getMetaInfoKeys,
getMethod,
getMethod,
getMethods,
getMethods,
getModifiers,
getName,
getPackage,
getResource,
getResourceAsStream,
getSigners,
getSimpleName,
getSourceCode,
getSuffix,
getSuperclass,
getTypeSuffixRule,
isAlterable,
isArray,
isAssignableFrom,
isExecutable,
isInSamePackage,
isInstance,
isInterface,
isPrimitive,
isPrimitiveWrapper,
isRegisteredKeyword,
makeCopy,
makeExpression,
makeExpression,
makeStatement,
makeStatement,
makeStatementList,
makeStatementList,
newInstance,
primitiveWrapper,
putMetaInfo,
removeClass,
removeConstructor,
removeField,
removeMethod,
resolveException,
resolveException,
setInterfaces,
setName,
setSuperclass,
signature,
toString,
translateDefinition,
unwrappedPrimitive,
waitTranslation,
writeMetaInfo |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Metaclass
public Metaclass(Environment outer_env,
OJClass declarer,
ClassDeclaration ptree)
Metaclass
public Metaclass(java.lang.Class javaclass,
MetaInfo minfo)
translateDefinition
public void translateDefinition()
throws MOPException
- Overrides:
- translateDefinition in class OJClass
isRegisteredModifier
public static final boolean isRegisteredModifier(java.lang.String keyword)