Class MongoField
java.lang.Object
org.springframework.data.mongodb.core.mapping.MongoField
Value Object for representing a field to read/write within a MongoDB
Document
.- Since:
- 4.2
- Author:
- Christoph Strobl
-
Nested Class Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
MongoField
(FieldName name, Class<?> targetFieldType, int fieldOrder) protected
MongoField
(FieldName name, FieldType fieldType, int fieldOrder) -
Method Summary
Modifier and TypeMethodDescriptionstatic MongoField.MongoFieldBuilder
builder()
boolean
static MongoField
Create a newMongoField
with given name.static MongoField
Create a newMongoField
with given name.Get the fields target type if defined.getName()
int
getOrder()
Get the position of the field within the target document.int
hashCode()
toString()
-
Constructor Details
-
MongoField
-
MongoField
-
-
Method Details
-
fromKey
Create a newMongoField
with given name.- Parameters:
name
- the name to be used as is (with all its potentially special characters).- Returns:
- new instance of
MongoField
.
-
fromPath
Create a newMongoField
with given name.- Parameters:
name
- the name to be used path expression.- Returns:
- new instance of
MongoField
.
-
builder
- Returns:
- new instance of
MongoField.MongoFieldBuilder
.
-
getName
- Returns:
- never null.
-
getOrder
public int getOrder()Get the position of the field within the target document.- Returns:
Integer.MAX_VALUE
if undefined.
-
getFieldType
Get the fields target type if defined.- Returns:
- never null.
-
equals
-
hashCode
public int hashCode() -
toString
-