|
XCC/J 4.0-9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.marklogic.xcc.ValueFactory
public final class ValueFactory
This class contains various static factory methods that
return instances of XdmValue and XdmVariable.
| Method Summary | |
|---|---|
static XdmBinary |
newBinaryNode(Object value)
|
static XdmDuration |
newDuration(String serializedString)
Convenience method to construct an XdmDuration value. |
static XdmElement |
newElement(Object value)
A convenience method to construct an XdmElement value. |
static XdmSequence |
newSequence(XdmValue[] values)
Factory method to construct an XdmSequence from an array of
XdmValue objects. |
static XdmText |
newTextNode(Object value)
A convenience method to construct an XdmText value. |
static XdmValue |
newValue(ValueType valueType,
Object value)
Generic XdmValue creation factory method. |
static XdmVariable |
newVariable(XName name,
XdmValue value)
Factory method to create a variable (named value) from the given XName and XdmValue objects. |
static XSBoolean |
newXSBoolean(boolean value)
A convenience method to construct an XSBoolean value. |
static XSDate |
newXSDate(String value,
TimeZone timeZone,
Locale locale)
A convenience method to construct an XSDate value. |
static XSDateTime |
newXSDateTime(String value,
TimeZone timeZone,
Locale locale)
A convenience method to construct an XSDateTime value. |
static XSDuration |
newXSDuration(String value)
A convenience method to construct an XSDuration value. |
static XSDuration |
newXSDuration(XdmDuration duration)
A convenience method to construct an XSDuration value
from an XdmDuration object. |
static XSInteger |
newXSInteger(BigInteger value)
A convenience method to construct an XSInteger value. |
static XSInteger |
newXSInteger(long value)
A convenience method to construct an XSInteger value. |
static XSString |
newXSString(String value)
A convenience method to construct an XSString value. |
static XSTime |
newXSTime(String value,
TimeZone timeZone,
Locale locale)
A convenience method to construct an XSTime value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static XdmValue newValue(ValueType valueType,
Object value)
Generic XdmValue creation factory method.
Value types are enumerated in ValueType.
Examples are ValueType.XS_INTEGER,
ValueType.XS_BOOLEAN, ValueType.SEQUENCE,
ValueType.XS_STRING, etc.
NOTE: If you pass a valueType of ValueType.NODE,
it will be treated as ValueType.ELEMENT. Using
ValueType.NODE directly is discouraged, it is
defined as the common super-type for all node types.
Other node types that may be constructed are ValueType.TEXT
and ValueType.BINARY. In future releases,
creation of additional node value types will be supported.
valueType - An concrete subclass of ValueType
which indicates the type of value to create.value - An Object containing the actual value to
construct the object with. The specific class of this
object is be dependent on the valueType argument. If
the provided value is not consistent with the valueType
then a IllegalArgumentException may be thrown.
XdmValue.
IllegalArgumentException - If the provided value is
not consistent with the valueType.public static XdmElement newElement(Object value)
A convenience method to construct an XdmElement value.
XdmElement objects can be constructed from an XML String,
a W3C DOM Element or an InputStream.
value - An instance of String, Element or InputStream.
XdmElement.
IllegalArgumentException - If value is not a String,
Element or InputStream.public static XdmText newTextNode(Object value)
XdmText value.
XdmText objects can be constructed from an XML String,
a W3C DOM Text node or an InputStream.
value - An instance of String, Text or InputStream.
XdmText.
IllegalArgumentException - If value is not a String,
Text or InputStream.public static XdmBinary newBinaryNode(Object value)
public static XSString newXSString(String value)
XSString value.
value - A String to construct the XSString object with.
XSString.public static XSInteger newXSInteger(long value)
XSInteger value.
Note that an XQuery xs:integer can hold values larger than a
Java int or long.
value - A long to construct the XSInteger object with.
XSInteger.public static XSInteger newXSInteger(BigInteger value)
XSInteger value.
Note that an XQuery xs:integer can hold values larger than a
Java int or long, but these large value may be represented
with a BigInteger object.
value - A BigInteger to construct the XSInteger object with.
XSInteger.public static XSBoolean newXSBoolean(boolean value)
XSBoolean value.
value - A boolean to construct the
XSBoolean object with.
XSBoolean.
public static XSDateTime newXSDateTime(String value,
TimeZone timeZone,
Locale locale)
XSDateTime value.
value - A String representation of the date/time
in standard XQuery form (ie 2006-04-23T11:32:46).timeZone - A TimeZone object to apply to value,
null for default.locale - A Locale object to apply to the value,
null for default.
XSDateTime.
public static XSDate newXSDate(String value,
TimeZone timeZone,
Locale locale)
XSDate value.
value - A String representation of the date/time
in standard XQuery form (ie 2006-04-23).timeZone - A TimeZone object to apply to value,
null for default.locale - A Locale object to apply to the value,
null for default.
XSDate.
public static XSTime newXSTime(String value,
TimeZone timeZone,
Locale locale)
XSTime value.
value - A String representation of the date/time
in standard XQuery form (ie 11:32:46).timeZone - A TimeZone object to apply to value,
null for default.locale - A Locale object to apply to the value,
null for default.
XSDate.public static XSDuration newXSDuration(String value)
XSDuration value.
value - A String representation of the duration
(ie P2Y3M141DT12H46M12.34S).
XSDuration.public static XSDuration newXSDuration(XdmDuration duration)
XSDuration value
from an XdmDuration object.
duration - An instance XdmDuration
XSDuration.public static XdmDuration newDuration(String serializedString)
XdmDuration value.
serializedString - A String representation of
the duration (ie P2Y3M141DT12H46M12.34S).
XdmDuration.public static XdmSequence newSequence(XdmValue[] values)
XdmSequence from an array of
XdmValue objects.
values - An array of XdmValue instances.
XdmSequence object.
public static XdmVariable newVariable(XName name,
XdmValue value)
XName and XdmValue objects.
name - An XName that defines the name and (optional)
namespace of the XdmVariable.value - An instance of XdmValue which is the
value of the variable.
XdmVariable that encapsulates
the name and value parameters.
|
XCC/J 4.0-9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com