com.agfa.hap.sdo
Interface DataMapper<T>

All Known Implementing Classes:
DelegatingDataMapper, DelegatingPartialDataObjectMapper, FilteringPartialDataObjectMapper, JavaBeanMapper, PartialDataObjectMapper

public interface DataMapper<T>

Interface that allows any object to be exposed as DataObject instances. The implementation is guaranteed to work for DataObject instances as well.

Author:
AMOCZ

Method Summary
 T create(Type type)
           
 Type getCorrespondingType(java.lang.Class clazz)
           
 java.util.Iterator<? extends T> getObjects(T object, Property property)
           
 java.util.Collection<T> getProperties(java.util.Collection<T> object, Property bulkProperty, SnapshotDefinition def)
          Return the corresponding values for this bulk property for the given object.
 java.lang.Object getProperty(T object, Property property)
           
 Type getType(T object)
           
 boolean isBulkProperty(java.lang.Class clazz, Property property)
           
 boolean isProxy(T object)
           
 T newProxy(Type type, java.lang.Object identity)
          Create a new proxy.
 void setProperty(T object, Property property, java.lang.Object value)
          Assigns the given value to the property of the object.
 void setUnavailable(T object, Property property)
          Marks a property as unavailable (PartialDataObject#isAvailable(Property)}.
 

Method Detail

getType

Type getType(T object)
Returns:
The sdo type that corresponds with this object. It is assumed that for all properties of this type, appropriate values can be retrieved from the instance.
Throws:
throws - IllegalArgumentException in case no corresponding sdo type can be found.

getCorrespondingType

Type getCorrespondingType(java.lang.Class clazz)
Returns:
The sdo type that corresponds with this class. It is assumed that for all properties of this type, appropriate values can be retrieved from the instance.
Throws:
throws - IllegalArgumentException in case no corresponding sdo type can be found. TODO 1 mechanism for indication no type was found

getObjects

java.util.Iterator<? extends T> getObjects(T object,
                                           Property property)
Returns:
An iterator over all values of this property of the given Object. Property should be a many-valued property. returns an "empty" iterator in case the property is null (SDO doesn't have the concept of a many valued property that can be null)

getProperty

java.lang.Object getProperty(T object,
                             Property property)
Returns:
The value of the property for the given object.

setProperty

void setProperty(T object,
                 Property property,
                 java.lang.Object value)
Assigns the given value to the property of the object. If the property is many-valued, adds the property to the collection of values.


isBulkProperty

boolean isBulkProperty(java.lang.Class clazz,
                       Property property)
Returns:
if this property is a bulk property for the given implementation clazz. Bulk properties are accessed in bulk (@see getProperties(Collection, Property, SnapshotDefinition) to allow more efficient retrieval.

getProperties

java.util.Collection<T> getProperties(java.util.Collection<T> object,
                                      Property bulkProperty,
                                      SnapshotDefinition def)
Return the corresponding values for this bulk property for the given object. A snapshotdefinition is passed as indication for which child objects are needed as well.


setUnavailable

void setUnavailable(T object,
                    Property property)
Marks a property as unavailable (PartialDataObject#isAvailable(Property)}.


isProxy

boolean isProxy(T object)

create

T create(Type type)
Returns:
A newly created instance of which the class corresponds to the given type.
See Also:
getCorrespondingType(Class)

newProxy

T newProxy(Type type,
           java.lang.Object identity)
Create a new proxy. The type is passed as parameter as this accessor might be usable for multiple types.

Returns:
null if the datamapper is unable to create a proxy for the given type


Copyright © 2007. All Rights Reserved.