Module spring.data.mongodb
Class QueryMapper.MetadataBackedField
java.lang.Object
org.springframework.data.mongodb.core.convert.QueryMapper.Field
org.springframework.data.mongodb.core.convert.QueryMapper.MetadataBackedField
- Enclosing class:
- QueryMapper
Extension of
QueryMapper.Field 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, POSITIONAL_OPERATOR -
Constructor Summary
ConstructorsConstructorDescriptionMetadataBackedField(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> context) Creates a newQueryMapper.MetadataBackedFieldwith the given name,MongoPersistentEntityandMappingContext.MetadataBackedField(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> context, MongoPersistentProperty property) Creates a newQueryMapper.MetadataBackedFieldwith the given name,MongoPersistentEntityandMappingContextwith the givenMongoPersistentProperty. -
Method Summary
Modifier and TypeMethodDescriptionprotected Converter<MongoPersistentProperty,String> Return theConverterto use for creating the mapped key of an association.Class<?>Returns the key to be used in the mapped document eventually.protected MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> protected PersistentPropertyPath<MongoPersistentProperty>getPath()Returns the underlyingMongoPersistentPropertybacking the field.protected Converter<MongoPersistentProperty,String> Return theConverterto be used to created the mapped key.Returns theMongoPersistentEntitythat field is conatined in.booleanReturns whether the field represents an association.booleanReturns whether the current field is the id field.Returns a newQueryMapper.Fieldwith the given name.Methods inherited from class org.springframework.data.mongodb.core.convert.QueryMapper.Field
containsAssociation, isMap
-
Constructor Details
-
MetadataBackedField
public MetadataBackedField(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> context) Creates a newQueryMapper.MetadataBackedFieldwith the given name,MongoPersistentEntityandMappingContext.- Parameters:
name- must not be null or empty.entity- must not be null.context- must not be null.
-
MetadataBackedField
public MetadataBackedField(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> context, @Nullable MongoPersistentProperty property) Creates a newQueryMapper.MetadataBackedFieldwith the given name,MongoPersistentEntityandMappingContextwith the givenMongoPersistentProperty.- Parameters:
name- must not be null or empty.entity- must not be null.context- must not be null.property- may be null.
-
-
Method Details
-
with
Description copied from class:QueryMapper.FieldReturns a newQueryMapper.Fieldwith the given name.- Overrides:
within classQueryMapper.Field- Parameters:
name- must not be null or empty.- Returns:
-
isIdField
public boolean isIdField()Description copied from class:QueryMapper.FieldReturns whether the current field is the id field.- Overrides:
isIdFieldin classQueryMapper.Field- Returns:
-
getProperty
Description copied from class:QueryMapper.FieldReturns the underlyingMongoPersistentPropertybacking 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:
getPropertyin classQueryMapper.Field- Returns:
- can be null.
-
getPropertyEntity
Description copied from class:QueryMapper.FieldReturns theMongoPersistentEntitythat field is conatined in.- Overrides:
getPropertyEntityin classQueryMapper.Field- Returns:
- can be null.
-
getEntity
-
isAssociation
public boolean isAssociation()Description copied from class:QueryMapper.FieldReturns whether the field represents an association.- Overrides:
isAssociationin classQueryMapper.Field- Returns:
-
getAssociation
- Overrides:
getAssociationin classQueryMapper.Field
-
getFieldType
- Overrides:
getFieldTypein classQueryMapper.Field
-
getMappedKey
Description copied from class:QueryMapper.FieldReturns the key to be used in the mapped document eventually.- Overrides:
getMappedKeyin classQueryMapper.Field- Returns:
-
getPath
-
getPropertyConverter
Return theConverterto be used to created the mapped key. Default implementation will useMongoPersistentProperty.PropertyToFieldNameConverter.- Returns:
-
getAssociationConverter
Return theConverterto use for creating the mapped key of an association. Default implementation isQueryMapper.AssociationConverter.- Returns:
- Since:
- 1.7
-
getMappingContext
protected MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> getMappingContext() -
getTypeHint
- Overrides:
getTypeHintin classQueryMapper.Field
-