Spring Data MongoDB - Core

org.springframework.data.mongodb.core.convert
Class QueryMapper.MetadataBackedField

java.lang.Object
  extended by org.springframework.data.mongodb.core.convert.QueryMapper.Field
      extended by org.springframework.data.mongodb.core.convert.QueryMapper.MetadataBackedField
Enclosing class:
QueryMapper

protected static class QueryMapper.MetadataBackedField
extends QueryMapper.Field

Extension of DocumentField to be backed with mapping metadata.

Author:
Oliver Gierke, Thomas Darimont

Field Summary
 
Fields inherited from class org.springframework.data.mongodb.core.convert.QueryMapper.Field
name
 
Constructor Summary
QueryMapper.MetadataBackedField(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> context)
          Creates a new QueryMapper.MetadataBackedField with the given name, MongoPersistentEntity and MappingContext.
QueryMapper.MetadataBackedField(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> context, MongoPersistentProperty property)
          Creates a new QueryMapper.MetadataBackedField with the given name, MongoPersistentEntity and MappingContext with the given MongoPersistentProperty.
 
Method Summary
 Association<MongoPersistentProperty> getAssociation()
           
 String getMappedKey()
          Returns the key to be used in the mapped document eventually.
protected  PersistentPropertyPath<MongoPersistentProperty> getPath()
           
 MongoPersistentProperty getProperty()
          Returns the underlying MongoPersistentProperty backing the field.
protected  Converter<MongoPersistentProperty,String> getPropertyConverter()
          Return the Converter to be used to created the mapped key.
 MongoPersistentEntity<?> getPropertyEntity()
          Returns the MongoPersistentEntity that field is conatined in.
 boolean isAssociation()
          Returns whether the field represents an association.
 boolean isIdField()
          Returns whether the current field is the id field.
 QueryMapper.MetadataBackedField with(String name)
          Returns a new DocumentField with the given name.
 
Methods inherited from class org.springframework.data.mongodb.core.convert.QueryMapper.Field
containsAssociation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryMapper.MetadataBackedField

public QueryMapper.MetadataBackedField(String name,
                                       MongoPersistentEntity<?> entity,
                                       MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> context)
Creates a new QueryMapper.MetadataBackedField with the given name, MongoPersistentEntity and MappingContext.

Parameters:
name - must not be null or empty.
entity - must not be null.
context - must not be null.

QueryMapper.MetadataBackedField

public QueryMapper.MetadataBackedField(String name,
                                       MongoPersistentEntity<?> entity,
                                       MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> context,
                                       MongoPersistentProperty property)
Creates a new QueryMapper.MetadataBackedField with the given name, MongoPersistentEntity and MappingContext with the given MongoPersistentProperty.

Parameters:
name - must not be null or empty.
entity - must not be null.
context - must not be null.
property - may be null.
Method Detail

with

public QueryMapper.MetadataBackedField with(String name)
Description copied from class: QueryMapper.Field
Returns a new DocumentField with the given name.

Overrides:
with in class QueryMapper.Field
Parameters:
name - must not be null or empty.
Returns:

isIdField

public boolean isIdField()
Description copied from class: QueryMapper.Field
Returns whether the current field is the id field.

Overrides:
isIdField in class QueryMapper.Field
Returns:

getProperty

public MongoPersistentProperty getProperty()
Description copied from class: QueryMapper.Field
Returns the underlying MongoPersistentProperty backing the field. For path traversals this will be the property that represents the value to handle. This means it'll be the leaf property for plain paths or the association property in case we refer to an association somewhere in the path.

Overrides:
getProperty in class QueryMapper.Field
Returns:

getPropertyEntity

public MongoPersistentEntity<?> getPropertyEntity()
Description copied from class: QueryMapper.Field
Returns the MongoPersistentEntity that field is conatined in.

Overrides:
getPropertyEntity in class QueryMapper.Field
Returns:

isAssociation

public boolean isAssociation()
Description copied from class: QueryMapper.Field
Returns whether the field represents an association.

Overrides:
isAssociation in class QueryMapper.Field
Returns:

getAssociation

public Association<MongoPersistentProperty> getAssociation()
Overrides:
getAssociation in class QueryMapper.Field

getMappedKey

public String getMappedKey()
Description copied from class: QueryMapper.Field
Returns the key to be used in the mapped document eventually.

Overrides:
getMappedKey in class QueryMapper.Field
Returns:

getPath

protected PersistentPropertyPath<MongoPersistentProperty> getPath()

getPropertyConverter

protected Converter<MongoPersistentProperty,String> getPropertyConverter()
Return the Converter to be used to created the mapped key. Default implementation will use MongoPersistentProperty.PropertyToFieldNameConverter.

Returns:

Spring Data MongoDB - Core

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