Spring Data MongoDB

org.springframework.data.mongodb.core.mapping
Class BasicMongoPersistentProperty

java.lang.Object
  extended by org.springframework.data.mapping.model.AbstractPersistentProperty<P>
      extended by org.springframework.data.mapping.model.AnnotationBasedPersistentProperty<MongoPersistentProperty>
          extended by org.springframework.data.mongodb.core.mapping.BasicMongoPersistentProperty
All Implemented Interfaces:
PersistentProperty<MongoPersistentProperty>, MongoPersistentProperty
Direct Known Subclasses:
CachingMongoPersistentProperty

public class BasicMongoPersistentProperty
extends AnnotationBasedPersistentProperty<MongoPersistentProperty>
implements MongoPersistentProperty

MongoDB specific MongoPersistentProperty implementation.

Author:
Oliver Gierke, Patryk Wasik

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.springframework.data.mongodb.core.mapping.MongoPersistentProperty
MongoPersistentProperty.PropertyToFieldNameConverter
 
Field Summary
 
Fields inherited from class org.springframework.data.mapping.model.AbstractPersistentProperty
association, field, information, name, owner, propertyDescriptor, rawType
 
Constructor Summary
BasicMongoPersistentProperty(Field field, PropertyDescriptor propertyDescriptor, MongoPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder)
          Creates a new BasicMongoPersistentProperty.
 
Method Summary
protected  Association<MongoPersistentProperty> createAssociation()
           
 DBRef getDBRef()
          Returns the DBRef if the property is a reference.
 String getFieldName()
          Returns the key to be used to store the value of the property inside a Mongo DBObject.
 int getFieldOrder()
          Returns the order of the field if defined.
 boolean isAssociation()
           
 boolean isDbReference()
          Returns whether the propert is a DBRef.
 boolean isIdProperty()
          Also considers fields as id that are of supported id type and name.
 boolean usePropertyAccess()
          Returns whether property access shall be used for reading the property value.
 
Methods inherited from class org.springframework.data.mapping.model.AnnotationBasedPersistentProperty
findAnnotation, getSpelExpression, isAnnotationPresent, isTransient, isVersionProperty
 
Methods inherited from class org.springframework.data.mapping.model.AbstractPersistentProperty
equals, getAssociation, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getPersistentEntityType, getRawType, getSetter, getType, getTypeInformation, hashCode, isArray, isCollectionLike, isEntity, isMap, shallBePersisted
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.data.mapping.PersistentProperty
getAssociation, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getPersistentEntityType, getRawType, getSetter, getSpelExpression, getType, getTypeInformation, isArray, isCollectionLike, isEntity, isMap, isTransient, isVersionProperty, shallBePersisted
 

Constructor Detail

BasicMongoPersistentProperty

public BasicMongoPersistentProperty(Field field,
                                    PropertyDescriptor propertyDescriptor,
                                    MongoPersistentEntity<?> owner,
                                    SimpleTypeHolder simpleTypeHolder)
Creates a new BasicMongoPersistentProperty.

Parameters:
field -
propertyDescriptor -
owner -
simpleTypeHolder -
Method Detail

isAssociation

public boolean isAssociation()
Specified by:
isAssociation in interface PersistentProperty<MongoPersistentProperty>
Overrides:
isAssociation in class AnnotationBasedPersistentProperty<MongoPersistentProperty>

isIdProperty

public boolean isIdProperty()
Also considers fields as id that are of supported id type and name.

Specified by:
isIdProperty in interface PersistentProperty<MongoPersistentProperty>
Overrides:
isIdProperty in class AnnotationBasedPersistentProperty<MongoPersistentProperty>
See Also:
SUPPORTED_ID_PROPERTY_NAMES, SUPPORTED_ID_TYPES

getFieldName

public String getFieldName()
Returns the key to be used to store the value of the property inside a Mongo DBObject.

Specified by:
getFieldName in interface MongoPersistentProperty
Returns:

getFieldOrder

public int getFieldOrder()
Description copied from interface: MongoPersistentProperty
Returns the order of the field if defined. Will return -1 if undefined.

Specified by:
getFieldOrder in interface MongoPersistentProperty
Returns:

createAssociation

protected Association<MongoPersistentProperty> createAssociation()
Specified by:
createAssociation in class AbstractPersistentProperty<MongoPersistentProperty>

isDbReference

public boolean isDbReference()
Description copied from interface: MongoPersistentProperty
Returns whether the propert is a DBRef. If this returns true you can expect MongoPersistentProperty.getDBRef() to return an non-null value.

Specified by:
isDbReference in interface MongoPersistentProperty
Returns:

getDBRef

public DBRef getDBRef()
Description copied from interface: MongoPersistentProperty
Returns the DBRef if the property is a reference.

Specified by:
getDBRef in interface MongoPersistentProperty
Returns:
See Also:
MongoPersistentProperty.isDbReference()

usePropertyAccess

public boolean usePropertyAccess()
Description copied from interface: MongoPersistentProperty
Returns whether property access shall be used for reading the property value. This means it will use the getter instead of field access.

Specified by:
usePropertyAccess in interface MongoPersistentProperty
Returns:

Spring Data MongoDB

Copyright © 2011-2013-2013 SpringSource. All Rights Reserved.