openjava.mop
Class Metaclass
java.lang.Object
|
+--openjava.mop.OJClass
|
+--openjava.mop.Metaclass
- All Implemented Interfaces:
- OJMember
- 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
- Version:
- 1.0
- Author:
- Michiaki Tatsubori
- See Also:
Object
Fields inherited from class openjava.mop.OJClass |
|
Methods inherited from class openjava.mop.OJClass |
addClass, addConstructor, addField, addInterface, addMethod, arrayForClasses, arrayOf, 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, replaceDotWithDollar, resolveException, resolveException, setDeclaringClass, setInterfaces, setName, setSuperclass, signature, toClasses, toString, translateDefinition, unwrappedPrimitive, waitTranslation, writeMetaInfo |
CONVENIENT
private static final String CONVENIENT
- See Also:
- Constant Field Values
Metaclass
public Metaclass(Environment outer_env,
OJClass declarer,
ClassDeclaration ptree)
Metaclass
public Metaclass(Class javaclass,
MetaInfo minfo)
translateDefinition
public void translateDefinition()
throws MOPException
- Overrides:
translateDefinition
in class OJClass
MOPException
isRegisteredModifier
public static final boolean isRegisteredModifier(String keyword)
makeSrcConstr
private OJConstructor makeSrcConstr()
throws MOPException
MOPException
makeByteConstr
private OJConstructor makeByteConstr()
throws MOPException
MOPException