org.oddjob.arooa.convert
Class DefaultConversionPath<F,T>

java.lang.Object
  extended by org.oddjob.arooa.convert.DefaultConversionPath<F,T>
All Implemented Interfaces:
ConversionPath<F,T>

public class DefaultConversionPath<F,T>
extends Object
implements ConversionPath<F,T>


Method Summary
<X> ConversionPath<F,X>
append(ConversionStep<T,X> following)
          Create a new ConversionPath by adding the given ConversionStep.
 boolean contains(Class<?> from)
          Test if this ConversionPath contains a conversion from the given Class.
 T convert(F from, ArooaConverter converter)
          Convert the given object using the ConversionPath.
 Class<F> getFromClass()
          Get the from Class of this ConversionPath.
<X,Y> ConversionStep<X,Y>
getStep(int step)
          Get the conversion step for the given index.
 Class<T> getToClass()
          Get the to Class of this ConversionPath.
static
<X> ConversionPath<X,X>
instance(Class<X> start)
           
 int length()
          Get the number of Steps in this ConversionPath.
<X> ConversionPath<X,T>
prepend(ConversionStep<X,F> preceeding)
          Create a new ConversionPath by prepending the given ConversionStep.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

instance

public static <X> ConversionPath<X,X> instance(Class<X> start)

append

public <X> ConversionPath<F,X> append(ConversionStep<T,X> following)
Description copied from interface: ConversionPath
Create a new ConversionPath by adding the given ConversionStep.

Specified by:
append in interface ConversionPath<F,T>
Returns:

prepend

public <X> ConversionPath<X,T> prepend(ConversionStep<X,F> preceeding)
Description copied from interface: ConversionPath
Create a new ConversionPath by prepending the given ConversionStep.

Specified by:
prepend in interface ConversionPath<F,T>
Returns:

getFromClass

public Class<F> getFromClass()
Description copied from interface: ConversionPath
Get the from Class of this ConversionPath.

Specified by:
getFromClass in interface ConversionPath<F,T>
Returns:

getToClass

public Class<T> getToClass()
Description copied from interface: ConversionPath
Get the to Class of this ConversionPath.

Specified by:
getToClass in interface ConversionPath<F,T>
Returns:

length

public int length()
Description copied from interface: ConversionPath
Get the number of Steps in this ConversionPath.

Specified by:
length in interface ConversionPath<F,T>
Returns:

contains

public boolean contains(Class<?> from)
Description copied from interface: ConversionPath
Test if this ConversionPath contains a conversion from the given Class.

Specified by:
contains in interface ConversionPath<F,T>
Returns:

getStep

public <X,Y> ConversionStep<X,Y> getStep(int step)
Description copied from interface: ConversionPath
Get the conversion step for the given index.

Specified by:
getStep in interface ConversionPath<F,T>
Parameters:
step - The index.
Returns:
A ConversionStep.

convert

public T convert(F from,
                 ArooaConverter converter)
          throws ConversionFailedException
Convert the given object using the ConversionPath.

Specified by:
convert in interface ConversionPath<F,T>
Parameters:
from -
Returns:
Throws:
ConvertletException
ConversionFailedException

toString

public String toString()
Overrides:
toString in class Object