Interface DatabaseField<P>
- Type Parameters:
P- the type of the field
public interface DatabaseField<P>
Database field interface to handle required methods.
-
Method Summary
Modifier and TypeMethodDescriptiongetPath()Gets field path.static <T extends org.bson.BsonValue>
TgetValueByPath(org.bson.BsonDocument bsonDocument, String path, Class<T> clazz) GetsBsonValuefrom given path.booleanisQuery()Checks if enum field is query field.org.bson.BsonValuetoBsonValue(P parent) Gets bson value of current field.
-
Method Details
-
getPath
Gets field path.- Returns:
String
-
isQuery
boolean isQuery()Checks if enum field is query field.- Returns:
- if enum field is query field , otherwise .
-
toBsonValue
Gets bson value of current field.- Parameters:
parent-DatabaseField- Returns:
BsonValue
-
getValueByPath
@NotNull static <T extends org.bson.BsonValue> T getValueByPath(@NotNull org.bson.BsonDocument bsonDocument, @NotNull String path, @NotNull Class<T> clazz) GetsBsonValuefrom given path.- Type Parameters:
T- the type of theBsonValue- Parameters:
bsonDocument-BsonDocumentto getBsonValuefrom.path-Stringpath to getBsonValuefrom.clazz-Classtype ofBsonValueto get.- Returns:
BsonValue- Throws:
NullPointerException- If any of object parameters is null.
-