public class TimestampElement extends AbstractElement
Modifier and Type | Field and Description |
---|---|
static ElementType |
TYPE
The BSON type for a long.
|
ELEMENT_TYPE
Constructor and Description |
---|
TimestampElement(String name,
long value)
Constructs a new
TimestampElement . |
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
Accepts the visitor and calls the
Visitor.visitTimestamp(java.lang.String, long) method. |
boolean |
equals(Object object)
Determines if the passed object is of this same type as this object and
if so that its fields are equal.
|
long |
getTime()
Returns the BSON timestamp value as the milliseconds since the epoch.
|
ElementType |
getType()
Returns the type for the BSON type.
|
Date |
getValueAsObject()
Returns the value for BSON element as a Java
Object type. |
int |
hashCode()
Computes a reasonable hash code.
|
TimestampElement |
withName(String name)
Creates a new element with the same type and value as this element but
with the specified name.
|
asElement, find, find, findFirst, findFirst, getName, getValueAsString, nullSafeEquals, queryPath, queryPath, toString
public static final ElementType TYPE
public TimestampElement(String name, long value)
TimestampElement
.name
- The name for the BSON long.value
- The BSON timestamp value as the milliseconds since the epoch.IllegalArgumentException
- If the name
is null
.public void accept(Visitor visitor)
Visitor.visitTimestamp(java.lang.String, long)
method.visitor
- The visitor for the element.Element.accept(Visitor)
public boolean equals(Object object)
equals
in class AbstractElement
object
- The object to compare to.Object.equals(java.lang.Object)
public long getTime()
public ElementType getType()
public Date getValueAsObject()
Object
type.
Automatic conversion from the Object-ified value to an element is
provided via the DocumentBuilder.add(String, Object)
method. Not
all element types will be successfully converted to the same element
duing a Element-->Object value-->Element conversion. This cases are noted
in the appropriate sub-type's JavaDoc.
Sub-types will also overload this method with the appropriate type
returned. e.g., The
StringElement.getValueAsObject()
method signature returns a String
.
Returns the Date
.
Object
type.public int hashCode()
hashCode
in class AbstractElement
public TimestampElement withName(String name)
Returns a new TimestampElement
.
name
- The new name for the element.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.