blob: dca208f81a96577b2d52e7c1c0f5ba965eef1981 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
* OrderKeeperClass.oj
*
*/
package examples.order;
import openjava.mop.*;
import openjava.ptree.ClassDeclaration;
import openjava.syntax.*;
public class OrderKeeperClass instantiates Metaclass extends OJClass
{
private static final String DEPEND = "dependsOn";
public void translateDefinition() throws MOPException {
OJClass base = getDepended();
System.out.println( "I'm " + getName() + ". " +
"After You, " + base.getName() + "." );
try {
waitTranslation( base );
} catch ( Exception e ) {
System.err.println( e.toString() );
}
System.out.println( getName() + " is finished." );
}
private OJClass getDepended() throws MOPException {
return OJClass.forName( getSuffix( DEPEND ).toString() );
}
public static boolean isRegisteredKeyword( String keyword ) {
return keyword.equals( DEPEND );
}
public static SyntaxRule getDeclSuffixRule( String keyword ) {
return keyword.equals( DEPEND ) ? new TypeNameRule() : null;
}
public String toString() {
return super.toString() + "(mc : OrderKeeper)";
}
}
|