biz.hammurapi.util
Class VisitorConverter

java.lang.Object
  extended by biz.hammurapi.util.VisitorConverter

public class VisitorConverter
extends java.lang.Object


Field Summary
static java.lang.String LEAVE
          Name of leave method.
static java.lang.String VISIT
          Name of visit method.
 
Constructor Summary
VisitorConverter()
           
 
Method Summary
 Visitor convert(java.lang.Object object)
          Converts object to visitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEAVE

public static final java.lang.String LEAVE
Name of leave method.

See Also:
Constant Field Values

VISIT

public static final java.lang.String VISIT
Name of visit method.

See Also:
Constant Field Values
Constructor Detail

VisitorConverter

public VisitorConverter()
Method Detail

convert

public Visitor convert(java.lang.Object object)
Converts object to visitor. If visitor is instance of Visitor, then this method returns object unchanged. Otherwise it introspects object for public visit() and leave() methods with a single argument returning boolean or void. If such methods are found they are made accessible in order to enable invocation of methods declared in anonymous and local classes. This method returns an anonymous visitor or polite visitor (if there are leave() methods). This anonymous (polite) visitor dispatches invocations to visit() and leave() methods with compatible types.

Parameters:
target - Object to be converted to visitor
Returns:
Object argument if it already implements visitor, or dispatcher to object's visit() and leave() methods.


Copyright © 2003 Hammurapi Group. All Rights Reserved.