public class NodeSetVariant extends VariantBase
NodeIterator
) value.
A NodeSetVariant is an ephemeral object: it cannot be stored for later use, it must be immediately converted and used. And this conversion may occur only once.
Unlike the NodeSetVariant, a PermanentNodeSetVariant
is not an
ephemeral object: it can be stored for later use (as long as the document
is not modified) and it can be converted several times.
Constructor and Description |
---|
NodeSetVariant(NodeIterator iter)
Constructs a Variant for specified node set.
|
Modifier and Type | Method and Description |
---|---|
boolean |
convertToBoolean()
Returns this Variant converted to a boolean.
|
NodeIterator |
convertToNodeSet()
Returns this Variant converted to a node set.
|
double |
convertToNumber()
Returns this Variant converted to a double.
|
Object |
convertToObject()
Returns this Variant converted to an alien Java object (typically
returned by an extension function invoked using Java introspection).
|
String |
convertToString()
Returns this Variant converted to a string.
|
boolean |
isNodeSet()
Returns
true if this Variant is a node set value. |
Variant |
makePermanent()
Used to convert a node set Variant to a permanent node set Variant.
|
String |
toString()
Returns a debug string which is not useful because this method cannot be
properly implemented without modifying the state of this object.
|
convertToPredicate, create, isBoolean, isNumber, isString
public NodeSetVariant(NodeIterator iter)
public NodeIterator convertToNodeSet()
Variant
convertToNodeSet
in interface Variant
convertToNodeSet
in class VariantBase
public Object convertToObject()
Variant
public String convertToString() throws EvalException
Variant
EvalException
- if this Variant cannot be converted to a string.public boolean convertToBoolean() throws EvalException
Variant
EvalException
- if this Variant cannot be converted to a
boolean.public double convertToNumber() throws EvalException
Variant
convertToNumber
in interface Variant
convertToNumber
in class VariantBase
EvalException
- if this Variant cannot be converted to a double.public Variant makePermanent() throws EvalException
Variant
makePermanent
in interface Variant
makePermanent
in class VariantBase
EvalException
- if the equivalent permanent node set cannot be
created (remember that node set are almost always lazily evaluated)NodeSetVariant
,
PermanentNodeSetVariant
public boolean isNodeSet()
Variant
true
if this Variant is a node set value.isNodeSet
in interface Variant
isNodeSet
in class VariantBase
public String toString()
PermanentNodeSetVariant
has not this problem.