com.openharbor.beck.get
Class SelfGetter

java.lang.Object
  extended bycom.openharbor.beck.get.DefaultGetter
      extended bycom.openharbor.beck.get.SelfGetter
All Implemented Interfaces:
Getter

public class SelfGetter
extends DefaultGetter

A Getter that returns the parent when asked for the child. This is used when the parent is unknown: a method that takes a parent and Getter can be given a child with no parent by passing the child in place of the parent, and an instance of this class as the Getter. For example, a root object is marshalled this way.

This design is torturous, and probably needs rethinking.


Field Summary
 
Fields inherited from class com.openharbor.beck.get.DefaultGetter
log
 
Constructor Summary
SelfGetter(java.lang.String name)
           
 
Method Summary
 java.lang.Class getClass(java.lang.Object source)
           
 java.lang.String getName(java.lang.Class sourceClass)
           
 java.lang.Object getValue(java.lang.Object source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelfGetter

public SelfGetter(java.lang.String name)
Method Detail

getName

public java.lang.String getName(java.lang.Class sourceClass)
Returns:
the name of the object in the context of its parent or null to indicate that the object is anonymous (e.g. a collection member).

getClass

public java.lang.Class getClass(java.lang.Object source)
Specified by:
getClass in interface Getter
Overrides:
getClass in class DefaultGetter

getValue

public java.lang.Object getValue(java.lang.Object source)
Returns:
the object to which this get refers.