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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/*
* This code was generated by ojc.
*/
/*
* FaceProvidedClass.oj
*
* @author Michiaki Tatsubori
* @see java.lang.Object
*
* COPYRIGHT 1999 by Michiaki Tatsubori, ALL RIGHTS RESERVED.
*/
package examples.facemake;
import openjava.mop.*;
import openjava.ptree.*;
import openjava.syntax.*;
public class FaceProvidedClass extends OJClass
{
/* overrides for translation */
public void translateDefinition()
throws MOPException
{
OJMethod[] methods = getMethods();
String fname = getName() + "Face";
FaceProvidedClass face = createEmptyInterface( fname );
OJSystem.addNewClass( face );
for (int i = 0; i < methods.length; ++i) {
OJMethod fmtd = OJMethod.makePrototype( methods[i] );
OJModifier modif = fmtd.getModifiers();
if (modif.isStatic()) {
continue;
}
if (isMethodOfObject( methods[i] )) {
continue;
}
fmtd.setModifiers( OJModifier.PUBLIC );
face.addMethod( fmtd );
}
addInterface( face );
}
public static FaceProvidedClass createEmptyInterface( String qname )
{
String pack = Environment.toPackageName( qname );
String sname = Environment.toSimpleName( qname );
ClassDeclaration cd = new ClassDeclaration( new ModifierList( ModifierList.PUBLIC ), sname, new TypeName[0], new TypeName[0], new MemberDeclarationList(), false );
FileEnvironment env = new FileEnvironment( OJSystem.env, pack, sname );
return new FaceProvidedClass( env, null, cd );
}
public static boolean isMethodOfObject( OJMethod m )
{
try {
OJClass clazz = OJSystem.OBJECT;
clazz.getMethod( m.getName(), m.getParameterTypes(), clazz );
return true;
} catch ( NoSuchMemberException ex ) {
return false;
}
}
public FaceProvidedClass( openjava.mop.Environment oj_param0, openjava.mop.OJClass oj_param1, openjava.ptree.ClassDeclaration oj_param2 )
{
super( oj_param0, oj_param1, oj_param2 );
}
public FaceProvidedClass( java.lang.Class oj_param0, openjava.mop.MetaInfo oj_param1 )
{
super( oj_param0, oj_param1 );
}
}
|