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

Field Summary
private static String CONVENIENT
           
 
Fields inherited from class openjava.mop.OJClass
 
Fields inherited from interface openjava.mop.OJMember
DECLARED, PUBLIC
 
Constructor Summary
Metaclass(Class javaclass, MetaInfo minfo)
           
Metaclass(Environment outer_env, OJClass declarer, ClassDeclaration ptree)
           
 
Method Summary
static boolean isRegisteredModifier(String keyword)
           
private  OJConstructor makeByteConstr()
           
private  OJConstructor makeSrcConstr()
           
 void translateDefinition()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONVENIENT

private static final String CONVENIENT
See Also:
Constant Field Values
Constructor Detail

Metaclass

public Metaclass(Environment outer_env,
                 OJClass declarer,
                 ClassDeclaration ptree)

Metaclass

public Metaclass(Class javaclass,
                 MetaInfo minfo)
Method Detail

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

SourceForge.net_Logo