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, toString
public 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)
Document
public Field getField(java.lang.String fieldName)
Document
public DocumentReference getReference()
Document
getReference
in interface Document
protected void setReference(DocumentReference reference)
reference
- The reference to where the document can be found.public java.net.URI getReferenceURI()
Document
URI
.getReferenceURI
in interface Document
public java.util.Collection<Field> getFields()
Document
public Field getTitleField()
Document
getTitleField
in interface Document
public Field getLastModifiedDateField()
Document
getLastModifiedDateField
in interface Document
public Field getAccessedDateField()
Document
getAccessedDateField
in interface Document
public Field getAuthorField()
Document
getAuthorField
in interface Document
public Field getBodyField()
Document
Document
interface are highly encouraged to use this field to
represent the primary content of the document.getBodyField
in interface Document
protected 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.