org.springframework.datastore.mapping
Class MappingFactory<R,T>

java.lang.Object
  extended by org.springframework.datastore.mapping.MappingFactory<R,T>
Direct Known Subclasses:
KeyValueMappingFactory

public abstract class MappingFactory<R,T>
extends Object

An abstract factory for creating persistent property instances.

Subclasses should implement the createMappedForm method in order to provide a mechanisms for representing the property in a form appropriate for mapping to the underlying datastore. Example:

  
      class RelationalPropertyFactory extends PropertyFactory {
            public Column createMappedForm(PersistentProperty mpp) {
                return new Column(mpp)
            }
      }
  
 

Since:
1.0

Field Summary
static Set<String> SIMPLE_TYPES
           
 
Constructor Summary
MappingFactory()
           
 
Method Summary
 Identity<T> createIdentity(PersistentEntity owner, MappingContext context, PropertyDescriptor pd)
          Creates an identifier property
 ManyToMany createManyToMany(PersistentEntity entity, MappingContext context, PropertyDescriptor property)
           
 ToOne createManyToOne(PersistentEntity entity, MappingContext context, PropertyDescriptor property)
           
abstract  R createMappedForm(PersistentEntity entity)
          Creates the mapped form of a persistent entity
abstract  T createMappedForm(PersistentProperty mpp)
          Creates the mapped form of a PersistentProperty instance
 OneToMany createOneToMany(PersistentEntity entity, MappingContext context, PropertyDescriptor property)
           
 ToOne createOneToOne(PersistentEntity entity, MappingContext context, PropertyDescriptor property)
           
protected  PropertyMapping<T> createPropertyMapping(PersistentProperty<T> property, PersistentEntity owner)
           
 Simple<T> createSimple(PersistentEntity owner, MappingContext context, PropertyDescriptor pd)
          Creates a simple property type used for mapping basic types such as String, long, integer etc.
static boolean isSimpleType(Class propType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIMPLE_TYPES

public static final Set<String> SIMPLE_TYPES
Constructor Detail

MappingFactory

public MappingFactory()
Method Detail

isSimpleType

public static boolean isSimpleType(Class propType)

createMappedForm

public abstract R createMappedForm(PersistentEntity entity)
Creates the mapped form of a persistent entity

Parameters:
entity - The entity
Returns:
The mapped form

createMappedForm

public abstract T createMappedForm(PersistentProperty mpp)
Creates the mapped form of a PersistentProperty instance

Parameters:
mpp - The PersistentProperty instance
Returns:
The mapped form

createIdentity

public Identity<T> createIdentity(PersistentEntity owner,
                                  MappingContext context,
                                  PropertyDescriptor pd)
Creates an identifier property

Parameters:
owner - The owner
context - The context
pd - The PropertyDescriptor
Returns:
An Identity instance

createSimple

public Simple<T> createSimple(PersistentEntity owner,
                              MappingContext context,
                              PropertyDescriptor pd)
Creates a simple property type used for mapping basic types such as String, long, integer etc.

Parameters:
owner - The owner
context - The MappingContext
pd - The PropertyDescriptor
Returns:
A Simple property type

createPropertyMapping

protected PropertyMapping<T> createPropertyMapping(PersistentProperty<T> property,
                                                   PersistentEntity owner)

createOneToOne

public ToOne createOneToOne(PersistentEntity entity,
                            MappingContext context,
                            PropertyDescriptor property)

createManyToOne

public ToOne createManyToOne(PersistentEntity entity,
                             MappingContext context,
                             PropertyDescriptor property)

createOneToMany

public OneToMany createOneToMany(PersistentEntity entity,
                                 MappingContext context,
                                 PropertyDescriptor property)

createManyToMany

public ManyToMany createManyToMany(PersistentEntity entity,
                                   MappingContext context,
                                   PropertyDescriptor property)