Spring Data Commons

org.springframework.data.mapping
Class AbstractPersistentProperty<P extends PersistentProperty<P>>

java.lang.Object
  extended by org.springframework.data.mapping.AbstractPersistentProperty<P>
All Implemented Interfaces:
PersistentProperty<P>
Direct Known Subclasses:
AnnotationBasedPersistentProperty

public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>>
extends Object
implements PersistentProperty<P>

Simple impementation of PersistentProperty.

Author:
Jon Brisbin , Oliver Gierke

Field Summary
protected  Association<P> association
           
protected  Field field
           
protected  TypeInformation<?> information
           
protected  String name
           
protected  PersistentEntity<?,P> owner
           
protected  PropertyDescriptor propertyDescriptor
           
protected  Class<?> rawType
           
 
Constructor Summary
AbstractPersistentProperty(Field field, PropertyDescriptor propertyDescriptor, PersistentEntity<?,P> owner)
           
 
Method Summary
protected abstract  Association<P> createAssociation()
           
 Association<P> getAssociation()
           
 Class<?> getComponentType()
          Returns the component type of the type if it is a Collection.
 Field getField()
           
 Class<?> getMapValueType()
          Returns the type of the values if the property is a Map.
 String getName()
          The name of the property
 PersistentEntity<?,P> getOwner()
           
 PropertyDescriptor getPropertyDescriptor()
           
 Class<?> getRawType()
          Returns the raw type as it's pulled from from the reflected property.
 String getSpelExpression()
           
 Class<?> getType()
          The type of the property
 TypeInformation<?> getTypeInformation()
           
 boolean isArray()
           
 boolean isAssociation()
           
 boolean isCollection()
           
 boolean isComplexType()
           
 boolean isEntity()
          Returns whether the property has to be regarded as entity which means its type will be also be considered to be a PersistentEntity.
 boolean isMap()
           
 boolean isTransient()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.data.mapping.model.PersistentProperty
isIdProperty
 

Field Detail

name

protected final String name

propertyDescriptor

protected final PropertyDescriptor propertyDescriptor

information

protected final TypeInformation<?> information

rawType

protected final Class<?> rawType

field

protected final Field field

association

protected final Association<P extends PersistentProperty<P>> association

owner

protected final PersistentEntity<?,P extends PersistentProperty<P>> owner
Constructor Detail

AbstractPersistentProperty

public AbstractPersistentProperty(Field field,
                                  PropertyDescriptor propertyDescriptor,
                                  PersistentEntity<?,P> owner)
Method Detail

createAssociation

protected abstract Association<P> createAssociation()

getOwner

public PersistentEntity<?,P> getOwner()
Specified by:
getOwner in interface PersistentProperty<P extends PersistentProperty<P>>

getName

public String getName()
Description copied from interface: PersistentProperty
The name of the property

Specified by:
getName in interface PersistentProperty<P extends PersistentProperty<P>>
Returns:
The property name

getType

public Class<?> getType()
Description copied from interface: PersistentProperty
The type of the property

Specified by:
getType in interface PersistentProperty<P extends PersistentProperty<P>>
Returns:
The property type

getRawType

public Class<?> getRawType()
Description copied from interface: PersistentProperty
Returns the raw type as it's pulled from from the reflected property.

Specified by:
getRawType in interface PersistentProperty<P extends PersistentProperty<P>>
Returns:
the raw type of the property.

getTypeInformation

public TypeInformation<?> getTypeInformation()
Specified by:
getTypeInformation in interface PersistentProperty<P extends PersistentProperty<P>>

getPropertyDescriptor

public PropertyDescriptor getPropertyDescriptor()
Specified by:
getPropertyDescriptor in interface PersistentProperty<P extends PersistentProperty<P>>

getField

public Field getField()
Specified by:
getField in interface PersistentProperty<P extends PersistentProperty<P>>

getSpelExpression

public String getSpelExpression()
Specified by:
getSpelExpression in interface PersistentProperty<P extends PersistentProperty<P>>

isTransient

public boolean isTransient()
Specified by:
isTransient in interface PersistentProperty<P extends PersistentProperty<P>>

isAssociation

public boolean isAssociation()
Specified by:
isAssociation in interface PersistentProperty<P extends PersistentProperty<P>>

getAssociation

public Association<P> getAssociation()
Specified by:
getAssociation in interface PersistentProperty<P extends PersistentProperty<P>>

isCollection

public boolean isCollection()
Specified by:
isCollection in interface PersistentProperty<P extends PersistentProperty<P>>

isMap

public boolean isMap()
Specified by:
isMap in interface PersistentProperty<P extends PersistentProperty<P>>

isArray

public boolean isArray()
Specified by:
isArray in interface PersistentProperty<P extends PersistentProperty<P>>

isComplexType

public boolean isComplexType()
Specified by:
isComplexType in interface PersistentProperty<P extends PersistentProperty<P>>

isEntity

public boolean isEntity()
Description copied from interface: PersistentProperty
Returns whether the property has to be regarded as entity which means its type will be also be considered to be a PersistentEntity.

Specified by:
isEntity in interface PersistentProperty<P extends PersistentProperty<P>>
Returns:

getComponentType

public Class<?> getComponentType()
Description copied from interface: PersistentProperty
Returns the component type of the type if it is a Collection. Will return the type of the key if the property is a Map.

Specified by:
getComponentType in interface PersistentProperty<P extends PersistentProperty<P>>
Returns:
the component type, the map's key type or null if neither Collection nor Map.

getMapValueType

public Class<?> getMapValueType()
Description copied from interface: PersistentProperty
Returns the type of the values if the property is a Map.

Specified by:
getMapValueType in interface PersistentProperty<P extends PersistentProperty<P>>
Returns:
the map's value type or null if no Map

Spring Data Commons

Copyright © 2011. All Rights Reserved.