Spring Data MongoDB - Core

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, Thomas Darimont

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, FieldNamingStrategy fieldNamingStrategy)
          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 isDbReference()
          Returns whether the propert is a DBRef.
 boolean isExplicitIdProperty()
          Returns whether the property is explicitly marked as an identifier property of the owning PersistentEntity.
 boolean isIdProperty()
          Also considers fields as id that are of supported id type and name.
 
Methods inherited from class org.springframework.data.mapping.model.AnnotationBasedPersistentProperty
findAnnotation, findPropertyOrOwnerAnnotation, getSpelExpression, isAnnotationPresent, isAssociation, isTransient, isVersionProperty, toString, usePropertyAccess
 
Methods inherited from class org.springframework.data.mapping.model.AbstractPersistentProperty
equals, getActualType, 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, wait, wait, wait
 
Methods inherited from interface org.springframework.data.mongodb.core.mapping.MongoPersistentProperty
usePropertyAccess
 
Methods inherited from interface org.springframework.data.mapping.PersistentProperty
findAnnotation, findPropertyOrOwnerAnnotation, getActualType, getAssociation, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getPersistentEntityType, getRawType, getSetter, getSpelExpression, getType, getTypeInformation, isAnnotationPresent, isArray, isAssociation, isCollectionLike, isEntity, isMap, isTransient, isVersionProperty, shallBePersisted
 

Constructor Detail

BasicMongoPersistentProperty

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

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

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

isExplicitIdProperty

public boolean isExplicitIdProperty()
Description copied from interface: MongoPersistentProperty
Returns whether the property is explicitly marked as an identifier property of the owning PersistentEntity. A property is an explicit id property if it is annotated with @see Id.

Specified by:
isExplicitIdProperty in interface MongoPersistentProperty
Returns:

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()

Spring Data MongoDB - Core

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.