public class DocumentReference extends Object implements DocumentAssignable
A DocumentReference contains:
$ref
.$id
.$db
(Optional).Modifier and Type | Field and Description |
---|---|
static String |
COLLECTION_FIELD_NAME
The name for the collection name field.
|
static String |
DATABASE_FIELD_NAME
The name for the database name field.
|
static String |
ID_FIELD_NAME
The name for the id field.
|
Constructor and Description |
---|
DocumentReference(String collectionName,
Element id)
Creates a new DocumentReference.
|
DocumentReference(String databaseName,
String collectionName,
Element id)
Creates a new DocumentReference.
|
Modifier and Type | Method and Description |
---|---|
Document |
asDocument()
Converts the object into a document.
|
boolean |
equals(Object object) |
String |
getCollectionName()
Returns the name of the collection being referenced.
|
String |
getDatabaseName()
Returns the name of the database being referenced.
|
Element |
getId()
Returns the id of the document being referenced.
|
int |
hashCode() |
protected boolean |
nullSafeEquals(Object rhs,
Object lhs)
Does a null safe equals comparison.
|
String |
toString() |
public static final String COLLECTION_FIELD_NAME
public static final String DATABASE_FIELD_NAME
public static final String ID_FIELD_NAME
public DocumentReference(String collectionName, Element id) throws IllegalArgumentException
collectionName
- The name of the collection being referenced.id
- The id of the document being referenced. The name of the
element is ignored within the DocumentReference
.IllegalArgumentException
- If the collectionName
or id
are
null
.public DocumentReference(String databaseName, String collectionName, Element id) throws IllegalArgumentException
databaseName
- The name of the database being referenced.collectionName
- The name of the collection being referenced.id
- The id of the document being referenced. The name of the
element is ignored within the DocumentReference
.IllegalArgumentException
- If the collectionName
or id
are
null
.public Document asDocument()
Overriden to return a DBRef style document. This is the reference as a document not the referenced document.
asDocument
in interface DocumentAssignable
public boolean equals(Object object)
Overriden to compare the object
to this DocumentReference
.
public String getCollectionName()
public String getDatabaseName()
null
.public Element getId()
public int hashCode()
Overriden to compute a reasonable hash for this DocumentReference
.
public String toString()
Overriden to return a JSON like representation of the
DocumentReference
.
Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.