public class JavaScriptElement extends AbstractElement
Modifier and Type | Field and Description |
---|---|
static ElementType |
TYPE
The BSON type for a string.
|
ELEMENT_TYPE
Constructor and Description |
---|
JavaScriptElement(String name,
String javaScript)
Constructs a new
JavaScriptElement . |
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
Accepts the visitor and calls the
Visitor.visitJavaScript(String,String) 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.
|
String |
getJavaScript()
Returns the BSON JavaScript value.
|
ElementType |
getType()
Returns the type for the BSON type.
|
int |
hashCode()
Computes a reasonable hash code.
|
JavaScriptElement |
withName(String name)
Creates a new element with the same type and value as this element but
with the specified name.
|
public static final ElementType TYPE
public JavaScriptElement(String name, String javaScript)
JavaScriptElement
.name
- The name for the BSON string.javaScript
- The BSON JavaScript value.IllegalArgumentException
- If the name
or javaScript
is
null
.public void accept(Visitor visitor)
Visitor.visitJavaScript(String,String)
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 String getJavaScript()
public ElementType getType()
public int hashCode()
hashCode
in class AbstractElement
public JavaScriptElement withName(String name)
Returns a new JavaScriptElement
.
name
- The new name for the element.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.