org.simantics.databoard.adapter
Class AdapterFactory

java.lang.Object
  extended by org.simantics.databoard.adapter.AdapterFactory

public class AdapterFactory
extends java.lang.Object

AdapterRepository is a factory and a collection of adapters.

Author:
Toni Kalajainen

Constructor Summary
AdapterFactory()
           
 
Method Summary
 java.lang.Object adapt(java.lang.Object value, Binding domain, Binding range)
          Adapt a value of one type to another.
 java.lang.Object adaptUnchecked(java.lang.Object value, Binding domain, Binding range)
          Adapt a value of one type to another
 java.lang.Object clone(java.lang.Object value, Binding domain, Binding range)
          Clone a value to a type to another.
 java.lang.Object cloneUnchecked(java.lang.Object value, Binding domain, Binding range)
          Clone a value of one binding to another.
 Adapter getAdapter(Binding domain, Binding range, boolean typeAdapter, boolean mustClone)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdapterFactory

public AdapterFactory()
Method Detail

getAdapter

public Adapter getAdapter(Binding domain,
                          Binding range,
                          boolean typeAdapter,
                          boolean mustClone)
                   throws AdapterConstructionException
Throws:
AdapterConstructionException

adapt

public java.lang.Object adapt(java.lang.Object value,
                              Binding domain,
                              Binding range)
                       throws AdaptException
Adapt a value of one type to another.

Parameters:
value -
domain -
range -
Returns:
adapted value
Throws:
AdapterConstructionException
AdaptException

adaptUnchecked

public java.lang.Object adaptUnchecked(java.lang.Object value,
                                       Binding domain,
                                       Binding range)
                                throws RuntimeAdapterConstructionException,
                                       RuntimeAdaptException
Adapt a value of one type to another

Parameters:
value -
domain -
range -
Returns:
adapted value
Throws:
AdapterConstructionException
AdaptException
RuntimeAdapterConstructionException
RuntimeAdaptException

clone

public java.lang.Object clone(java.lang.Object value,
                              Binding domain,
                              Binding range)
                       throws AdaptException
Clone a value to a type to another. Bindings that handle immutable values may return the same instance, others will guarantee a complete copy.

Parameters:
value -
domain -
range -
Returns:
adapted value
Throws:
AdapterConstructionException
AdaptException

cloneUnchecked

public java.lang.Object cloneUnchecked(java.lang.Object value,
                                       Binding domain,
                                       Binding range)
                                throws RuntimeAdapterConstructionException,
                                       RuntimeAdaptException
Clone a value of one binding to another. Bindings that handle immutable values may return the same instance, others will guarantee a complete copy.

Parameters:
value -
domain -
range -
Returns:
adapted value
Throws:
AdapterConstructionException
AdaptException
RuntimeAdapterConstructionException
RuntimeAdaptException