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 Type
    Method
    Description
    Gets field path.
    static <T extends org.bson.BsonValue>
    T
    getValueByPath(org.bson.BsonDocument bsonDocument, String path, Class<T> clazz)
    Gets BsonValue from given path.
    boolean
    Checks if enum field is query field.
    org.bson.BsonValue
    toBsonValue(P parent)
    Gets bson value of current field.
  • Method Details

    • getPath

      @NotNull String 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

      @NotNull org.bson.BsonValue toBsonValue(@NotNull P parent)
      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)
      Gets BsonValue from given path.
      Type Parameters:
      T - the type of the BsonValue
      Parameters:
      bsonDocument - BsonDocument to get BsonValue from.
      path - String path to get BsonValue from.
      clazz - Class type of BsonValue to get.
      Returns:
      BsonValue
      Throws:
      NullPointerException - If any of object parameters is null.