diff options
Diffstat (limited to 'tutorial/examples/bca/RTReflClass.java')
-rw-r--r-- | tutorial/examples/bca/RTReflClass.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tutorial/examples/bca/RTReflClass.java b/tutorial/examples/bca/RTReflClass.java new file mode 100644 index 0000000..429b241 --- /dev/null +++ b/tutorial/examples/bca/RTReflClass.java @@ -0,0 +1,51 @@ +/* + * This code was generated by ojc. + */ +/* + * RTReflClass.oj + * + * Source Code Adaptation example. + * + * Oct 29, 1999 by Michiaki Tatsubori + */ +package examples.bca; + + +import openjava.mop.*; +import openjava.ptree.*; +import openjava.syntax.*; + + +/** + * The class <code>RTReflClass</code> patches the class + * implementing <code>Writable</code> to implement <code>Printable</code>. + */ +public class RTReflClass extends OJClass +{ + + /** Overrides to translate definition */ + public void translateDefinition() + throws MOPException + { + if (!openjava.mop.OJClass.forClass( Writable.class ).isAssignableFrom( this )) { + return; + } + addInterface( openjava.mop.OJClass.forClass( Printable.class ) ); + OJMethod facemtd = getMethod( "write", new OJClass[]{ openjava.mop.OJClass.forClass( java.io.PrintStream.class ) } ); + OJMethod impmtd = new OJMethod( this, facemtd.getModifiers(), facemtd.getReturnType(), facemtd.getName(), facemtd.getParameterTypes(), facemtd.getExceptionTypes(), null ); + addMethod( impmtd ); + StatementList body = makeStatementList( "this.write(java.lang.System.out);" ); + impmtd.setBody( body ); + } + + public RTReflClass( openjava.mop.Environment oj_param0, openjava.mop.OJClass oj_param1, openjava.ptree.ClassDeclaration oj_param2 ) + { + super( oj_param0, oj_param1, oj_param2 ); + } + + public RTReflClass( java.lang.Class oj_param0, openjava.mop.MetaInfo oj_param1 ) + { + super( oj_param0, oj_param1 ); + } + +} |