public class AbstractDocument extends AbstractNamed implements Document
Document interface. It holds the
reference plus the fields as a mapping of field names to values.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACCESSED_DATE_FIELD_NAME
The name of the last accessed date field is "accessedDate".
|
static java.lang.String |
AUTHOR_FIELD_NAME
The name of the author field is "author".
|
static java.lang.String |
BODY_FIELD_NAME
The name of the body field is "body".
|
protected java.util.HashMap<java.lang.String,Field> |
fieldMap
A mapping of field names to fields.
|
static java.lang.String |
LAST_MODIFIED_DATE_FIELD_NAME
The name of the last modified date field is "lastModifiedDate".
|
protected DocumentReference |
reference
A reference to where the document came from.
|
static java.lang.String |
TITLE_FIELD_NAME
The name of the title field is "title".
|
name| Constructor and Description |
|---|
AbstractDocument()
Creates a new
AbstractDocument. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addField(Field field)
Adds a field to the document.
|
Field |
getAccessedDateField()
Gets the commonly-used accessed date field.
|
Field |
getAuthorField()
Gets the commonly-used author field.
|
Field |
getBodyField()
Gets the commonly-used body field.
|
Field |
getField(java.lang.String fieldName)
Gets the field from the document with the given field name, if it exists.
|
protected java.util.HashMap<java.lang.String,Field> |
getFieldMap()
Gets the mapping of field name to the field.
|
java.util.Collection<Field> |
getFields()
Gets the collection of the fields that make up the document.
|
Field |
getLastModifiedDateField()
Gets the commonly-used last modified date field.
|
DocumentReference |
getReference()
Gets a reference to the location of the document so that it can be
retrieved again later.
|
java.net.URI |
getReferenceURI()
Gets the reference to the location of the document as a
URI. |
Field |
getTitleField()
Gets the commonly-used title field.
|
boolean |
hasField(java.lang.String fieldName)
Determines if this document has a field of the given name.
|
protected void |
removeField(java.lang.String fieldName)
Removes a field of the given name from the document.
|
protected void |
setFieldMap(java.util.HashMap<java.lang.String,Field> fieldMap)
Sets the mapping of field name to the field.
|
protected void |
setReference(DocumentReference reference)
Sets the reference to where the document can be found.
|
clone, getName, setName, toStringpublic static final java.lang.String TITLE_FIELD_NAME
public static final java.lang.String LAST_MODIFIED_DATE_FIELD_NAME
public static final java.lang.String ACCESSED_DATE_FIELD_NAME
public static final java.lang.String AUTHOR_FIELD_NAME
public static final java.lang.String BODY_FIELD_NAME
protected DocumentReference reference
protected java.util.HashMap<java.lang.String,Field> fieldMap
protected void addField(Field field)
field - The field to add.protected void removeField(java.lang.String fieldName)
fieldName - The name of the field to remove.public boolean hasField(java.lang.String fieldName)
Documentpublic Field getField(java.lang.String fieldName)
Documentpublic DocumentReference getReference()
DocumentgetReference in interface Documentprotected void setReference(DocumentReference reference)
reference - The reference to where the document can be found.public java.net.URI getReferenceURI()
DocumentURI.getReferenceURI in interface Documentpublic java.util.Collection<Field> getFields()
Documentpublic Field getTitleField()
DocumentgetTitleField in interface Documentpublic Field getLastModifiedDateField()
DocumentgetLastModifiedDateField in interface Documentpublic Field getAccessedDateField()
DocumentgetAccessedDateField in interface Documentpublic Field getAuthorField()
DocumentgetAuthorField in interface Documentpublic Field getBodyField()
DocumentDocument interface are highly encouraged to use this field to
represent the primary content of the document.getBodyField in interface Documentprotected java.util.HashMap<java.lang.String,Field> getFieldMap()
protected void setFieldMap(java.util.HashMap<java.lang.String,Field> fieldMap)
fieldMap - The mapping of field name to field.