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.MetadataBackedField
with the given name,MongoPersistentEntity
andMappingContext
.MetadataBackedField
(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> context, MongoPersistentProperty property) Creates a newQueryMapper.MetadataBackedField
with the given name,MongoPersistentEntity
andMappingContext
with the givenMongoPersistentProperty
. -
Method Summary
Modifier and TypeMethodDescriptionprotected Converter<MongoPersistentProperty,
String> Return theConverter
to 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 underlyingMongoPersistentProperty
backing the field.protected Converter<MongoPersistentProperty,
String> Return theConverter
to be used to created the mapped key.Returns theMongoPersistentEntity
that field is conatined in.boolean
Returns whether the field represents an association.boolean
Returns whether the current field is the id field.Returns a newQueryMapper.Field
with 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.MetadataBackedField
with the given name,MongoPersistentEntity
andMappingContext
.- 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.MetadataBackedField
with the given name,MongoPersistentEntity
andMappingContext
with 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.Field
Returns a newQueryMapper.Field
with the given name.- Overrides:
with
in classQueryMapper.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 classQueryMapper.Field
- Returns:
-
getProperty
Description copied from class:QueryMapper.Field
Returns the underlyingMongoPersistentProperty
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 classQueryMapper.Field
- Returns:
- can be null.
-
getPropertyEntity
Description copied from class:QueryMapper.Field
Returns theMongoPersistentEntity
that field is conatined in.- Overrides:
getPropertyEntity
in classQueryMapper.Field
- Returns:
- can be null.
-
getEntity
-
isAssociation
public boolean isAssociation()Description copied from class:QueryMapper.Field
Returns whether the field represents an association.- Overrides:
isAssociation
in classQueryMapper.Field
- Returns:
-
getAssociation
- Overrides:
getAssociation
in classQueryMapper.Field
-
getFieldType
- Overrides:
getFieldType
in classQueryMapper.Field
-
getMappedKey
Description copied from class:QueryMapper.Field
Returns the key to be used in the mapped document eventually.- Overrides:
getMappedKey
in classQueryMapper.Field
- Returns:
-
getPath
-
getPropertyConverter
Return theConverter
to be used to created the mapped key. Default implementation will useMongoPersistentProperty.PropertyToFieldNameConverter
.- Returns:
-
getAssociationConverter
Return theConverter
to 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:
getTypeHint
in classQueryMapper.Field
-