aspoev.manager.adapter
Class InstanceAdapter

java.lang.Object
  extended byaspoev.manager.adapter.InstanceAdapter
Direct Known Subclasses:
CompositeObjectAdapter

public class InstanceAdapter
extends java.lang.Object

This is the strategy class in the AspOEv framework which encapsulates the concern of instance adaptation, or instance conversion. Implementing strategies must appropriately override the 'convert', 'unknownField', and 'unknownMethod' methods to adapt instances in the desired manner.


Constructor Summary
InstanceAdapter()
           
 
Method Summary
protected  MetaObject convert(MetaObject object, TypeReferenceElement type)
          Attempts to physically convert the objects by creating a new Vejal object of the requested type and copying all matching fields.
 java.lang.Object convertPrimitive(java.lang.Object primitive, TypeReferenceElement type)
          Provides default conversion for primitives, double to String, etc.
protected  java.lang.Object executeMethod(UnknownMethodInvokationException umie)
           
protected  TypeReferenceElement getCommonAncestor(java.util.LinkedList oneDerivation, java.util.LinkedList twoDerivation)
           
 java.lang.Object getDefaultValue(TypeReferenceElement type)
          Provides a default value for the argument type.
protected  java.util.LinkedList getDerivationHistory(TypeReferenceElement type)
          Gets the derivation of the specified version, all the way to the first version of the type.
 java.util.Collection getVersionDerivationPath(TypeReferenceElement one, TypeReferenceElement two)
          Gets the derivation differences of the two types, and the versions between them on the version derivation graph.
 DatabaseObject retypeObject(DatabaseObject object, TypeReferenceElement type)
          This method is called by the framework aspects, but it does not actually do the conversion - that is left up to the 'convert' method.
 void testVersionDerivation(TypeReferenceElement one, TypeReferenceElement two)
          For testing only.
 void unknownField(UnknownFieldReferenceException ufre)
          Takes the appropriate action when an UnknownFieldReferenceException is thrown.
 void unknownMethod(UnknownMethodInvokationException umie)
          Takes the appropriate action when an UnknownMethodInvokationException is thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceAdapter

public InstanceAdapter()
Method Detail

retypeObject

public final DatabaseObject retypeObject(DatabaseObject object,
                                         TypeReferenceElement type)
This method is called by the framework aspects, but it does not actually do the conversion - that is left up to the 'convert' method. This method essentially manages the database handles that maintain referential integrity to the object - it first removes them, then calls 'convert', then replaces them and returns the object.


convert

protected MetaObject convert(MetaObject object,
                             TypeReferenceElement type)
Attempts to physically convert the objects by creating a new Vejal object of the requested type and copying all matching fields. Implementing strategies can convert the object however they see fit.

Parameters:
object - The Object to convert
type - The type to convet the object to.

convertPrimitive

public java.lang.Object convertPrimitive(java.lang.Object primitive,
                                         TypeReferenceElement type)
Provides default conversion for primitives, double to String, etc.


getDefaultValue

public java.lang.Object getDefaultValue(TypeReferenceElement type)
Provides a default value for the argument type.


getDerivationHistory

protected java.util.LinkedList getDerivationHistory(TypeReferenceElement type)
Gets the derivation of the specified version, all the way to the first version of the type.


getCommonAncestor

protected TypeReferenceElement getCommonAncestor(java.util.LinkedList oneDerivation,
                                                 java.util.LinkedList twoDerivation)

getVersionDerivationPath

public java.util.Collection getVersionDerivationPath(TypeReferenceElement one,
                                                     TypeReferenceElement two)
Gets the derivation differences of the two types, and the versions between them on the version derivation graph.


testVersionDerivation

public void testVersionDerivation(TypeReferenceElement one,
                                  TypeReferenceElement two)
For testing only.


unknownField

public void unknownField(UnknownFieldReferenceException ufre)
Takes the appropriate action when an UnknownFieldReferenceException is thrown.


unknownMethod

public void unknownMethod(UnknownMethodInvokationException umie)
Takes the appropriate action when an UnknownMethodInvokationException is thrown.


executeMethod

protected java.lang.Object executeMethod(UnknownMethodInvokationException umie)