public interface Document
| Modifier and Type | Field and Description |
|---|---|
static Object |
FIELD_NOT_FOUND
This Object is returned from
getAndCheckField(String) if the field
does not exist. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other)
Returns true if the given object is equals to this Document.
|
default void |
foreach(BiConsumer<String,Object> action)
For each field in this document call
action
with the field's name and value. |
default Object |
getAndCheckField(String fieldName)
Checks if the field exists and if it does returns its value.
|
Object |
getField(String fieldName)
Reads the named field and returns its value.
|
List<String> |
getFieldNames()
Return an unmodifiable list of the field names.
|
boolean |
hasField(String fieldName)
Checks if the named field exists and returns the result.
|
int |
hashCode()
Generates a hashCode based on all fields of this Document.
|
@Immutable static final Object FIELD_NOT_FOUND
getAndCheckField(String) if the field
does not exist.boolean hasField(String fieldName)
fieldName - the name of the field to checktrue if the named field exists; otherwise falseList<String> getFieldNames()
Object getField(String fieldName)
null is
returned.
A null result indicates that the field does not exist or that it exists and its
value is currently null. The hasField method can be used
to figure out which of these two cases is true.
fieldName - name of the field to readnull is returned.RuntimeException - if the field could not be deserializedboolean equals(Object other)
Otherwise equality of two Documents is determined as follows:
A field is equal if all the following are true:
A field's value may be deserialized to determine if it is equals.
int hashCode()
default Object getAndCheckField(String fieldName)
FIELD_NOT_FOUND.
Otherwise, behaves the same as getField(String).
Some implementations may provide an implementation of this which
performs better than the default.fieldName - name of the field to readFIELD_NOT_FOUND is returned.RuntimeException - if the field could not be deserializeddefault void foreach(BiConsumer<String,Object> action)
action
with the field's name and value.
Some implementations may provide an implementation of this which
performs better than the default.action - called for each field in this document