public class NaryExpression extends Object implements Expression, ElementAssignable
Expression
with 2-N
operands.Modifier and Type | Field and Description |
---|---|
protected ArrayElement |
myExpressions
The expression expressed as an
ArrayElement . |
Constructor and Description |
---|
NaryExpression(String operator,
Expression... expressions)
Creates a new NaryExpression.
|
Modifier and Type | Method and Description |
---|---|
ArrayElement |
asElement()
Converts the object into an
Element . |
DocumentElement |
toElement(String name)
Returns the expression in the form of a BSON element.
|
protected final ArrayElement myExpressions
ArrayElement
.public NaryExpression(String operator, Expression... expressions)
operator
- The operator this object represents.expressions
- The sub expressions.public ArrayElement asElement()
Element
.
Overridden to return the sub expressions as a ArrayElement
:
{ "$op" : [ <e1>, <e2>, <e2>, ... ] }
asElement
in interface ElementAssignable
Element
.public DocumentElement toElement(String name)
Overridden to return the sub expressions as a document with a nested array element:
{ <name> : { "$op" : [ <e1>, <e2>, <e2>, ... ] } }
toElement
in interface Expression
name
- The name for the expression's element.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.