Save This Page
Home » struts-1.3.9-src » examples » adapter » [javadoc | source]
examples.adapter
public class: AdapterClass [javadoc | source]
java.lang.Object
   openjava.mop.OJClass
      examples.adapter.AdapterClass
The metaclass AdapterClass supports classes implementing an adapter role of the Adapter pattern. The target's methods with same signatures as the adaptee's are automatically implemented into the adapter class.

For example, the class VectorStack:

public class VectorStack instantiates AdapterClass
adapts Vector in v to Stack
{
Vector v;
public VectorStack( Vector v ) {
this.v = v;
}
public void push( Object o ) {
v.addElement( o );
}
public Object pop() {
return v.removeElementAt( v.size() - 1 );
}
}
would be automatically implemented with the forwarding methods size(), isEmpty(), hashCode(), etc, which are found in both the class Vector(adaptee) and the class Stack(target).

Field Summary
public static final  String KEY_ADAPTS     
Constructor:
 public AdapterClass(Class oj_param0,
    MetaInfo oj_param1) 
 public AdapterClass(Environment oj_param0,
    OJClass oj_param1,
    ClassDeclaration oj_param2) 
Method from examples.adapter.AdapterClass Summary:
getDeclSuffixRule,   isRegisteredKeyword,   translateDefinition
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from examples.adapter.AdapterClass Detail:
 public static SyntaxRule getDeclSuffixRule(String keyword) 
 public static boolean isRegisteredKeyword(String keyword) 
 public  void translateDefinition() throws MOPException