public class DoubleElement extends AbstractElement implements NumericElement
| Modifier and Type | Field and Description |
|---|---|
static ElementType |
TYPE
The BSON type for a double.
|
ELEMENT_TYPE| Constructor and Description |
|---|
DoubleElement(String name,
double value)
Constructs a new
DoubleElement. |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Visitor visitor)
Accepts the visitor and calls the
Visitor.visitDouble(java.lang.String, double) 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.
|
double |
getDoubleValue()
Returns the value cast to a double.
|
int |
getIntValue()
Returns the value cast to an integer.
|
long |
getLongValue()
Returns the value cast to a long.
|
ElementType |
getType()
Returns the type for the BSON type.
|
double |
getValue()
Returns the BSON double value.
|
int |
hashCode()
Computes a reasonable hash code.
|
String |
toString()
String form of the object.
|
DoubleElement |
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, nullSafeEquals, queryPath, queryPathclone, finalize, getClass, notify, notifyAll, wait, wait, waitfind, find, findFirst, findFirst, getName, queryPath, queryPathasElementpublic static final ElementType TYPE
public DoubleElement(String name, double value)
DoubleElement.name - The name for the BSON double.value - The BSON double value.public void accept(Visitor visitor)
Visitor.visitDouble(java.lang.String, double) method.accept in interface Elementvisitor - The visitor for the element.Element.accept(Visitor)public boolean equals(Object object)
equals in class AbstractElementobject - The object to compare to.Object.equals(java.lang.Object)public double getDoubleValue()
Note: There may be a loss of precision using this method if the
NumericElement is not a
DoubleElement.
Overridden to return the double value.
getDoubleValue in interface NumericElementpublic int getIntValue()
Note: There may be a loss of precision using this method if the
NumericElement is not a
IntegerElement.
Overridden to cast the double value to an integer.
getIntValue in interface NumericElementpublic long getLongValue()
Note: There may be a loss of precision using this method if the
NumericElement is not a
LongElement.
Overridden to cast the double value to a long.
getLongValue in interface NumericElementpublic ElementType getType()
public double getValue()
public int hashCode()
hashCode in class AbstractElementpublic String toString()
toString in class AbstractElementObject.toString()public DoubleElement withName(String name)
Returns a new DoubleElement.
Copyright © 2011-2012 Allanbank Consulting, Inc.. All Rights Reserved.