Package org.eclipse.rdf4j.model.util
Class Values
- java.lang.Object
-
- org.eclipse.rdf4j.model.util.Values
-
public class Values extends java.lang.ObjectFactory methods to quickly createValueobjects (IRI,Literal,BNode, andTriple) without having to create aValueFactoryfirst.Example usage:
import static org.eclipse.rdf4j.model.util.Values.iri; ... IRI foo = iri("http://example.org/foo");- Since:
- 3.5.0
- See Also:
Statements
-
-
Field Summary
Fields Modifier and Type Field Description private static ValueFactoryVALUE_FACTORYInternal shared value factory used for creating all values.
-
Constructor Summary
Constructors Modifier Constructor Description privateValues()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BNodebnode()Creates a newBNodestatic BNodebnode(java.lang.String nodeId)Creates a newBNodewith the supplied node identifier.static BNodebnode(ValueFactory vf)Creates a newBNodestatic BNodebnode(ValueFactory vf, java.lang.String nodeId)Creates a newBNodewith the supplied node identifier.private static LiteralcreateLiteralFromObject(ValueFactory valueFactory, java.lang.Object object, boolean throwExceptionOnFailure)Creates a typedLiteralout of the supplied object, mapping the runtime type of the object to the appropriate XML Schema type.static ValueFactorygetValueFactory()Get aValueFactory.static IRIiri(java.lang.Iterable<Namespace> namespaces, java.lang.String prefixedName)Create a newIRIfrom a supplied prefixed name, using the suppliednamespacesstatic IRIiri(java.lang.String iri)Create a newIRIusing the supplied iri stringstatic IRIiri(java.lang.String namespace, java.lang.String localName)Create a newIRIusing the supplied namespace name and local namestatic IRIiri(Namespace namespace, java.lang.String localName)static IRIiri(ValueFactory vf, java.lang.String iri)Create a newIRIusing the supplied iri stringstatic IRIiri(ValueFactory vf, java.lang.String namespace, java.lang.String localName)Create a newIRIusing the supplied namespace and local namestatic Literalliteral(boolean booleanValue)Creates a newLiteralwith the supplied boolean valuestatic Literalliteral(byte byteValue)Creates a newLiteralwith the supplied byte valuestatic Literalliteral(double doubleValue)Creates a newLiteralwith the supplied double valuestatic Literalliteral(float floatValue)Creates a newLiteralwith the supplied float valuestatic Literalliteral(int intValue)Creates a newLiteralwith the supplied int valuestatic Literalliteral(long longValue)Creates a newLiteralwith the supplied long valuestatic Literalliteral(short shortValue)Creates a newLiteralwith the supplied short valuestatic Literalliteral(java.lang.Object object)static Literalliteral(java.lang.Object object, boolean failOnUnknownType)static Literalliteral(java.lang.String lexicalValue)Creates a newLiteralwith the supplied lexical value.static Literalliteral(java.lang.String lexicalValue, java.lang.String languageTag)Creates a newLiteralwith the supplied lexical value.static Literalliteral(java.lang.String lexicalValue, CoreDatatype datatype)Creates a newLiteralwith the supplied lexical value and datatype.static Literalliteral(java.lang.String lexicalValue, IRI datatype)Creates a newLiteralwith the supplied lexical value and datatype.static Literalliteral(java.math.BigDecimal bigDecimal)Creates a newLiteralwith the suppliedBigDecimalvaluestatic Literalliteral(java.math.BigInteger bigInteger)Creates a newLiteralwith the suppliedBigIntegervaluestatic Literalliteral(java.time.temporal.TemporalAccessor value)Creates a newLiteralwith the suppliedTemporalAccessorvaluestatic Literalliteral(ValueFactory vf, boolean booleanValue)Creates a newLiteralwith the supplied boolean valuestatic Literalliteral(ValueFactory vf, byte byteValue)Creates a newLiteralwith the supplied byte valuestatic Literalliteral(ValueFactory vf, double doubleValue)Creates a newLiteralwith the supplied double valuestatic Literalliteral(ValueFactory vf, float floatValue)Creates a newLiteralwith the supplied float valuestatic Literalliteral(ValueFactory vf, int intValue)Creates a newLiteralwith the supplied int valuestatic Literalliteral(ValueFactory vf, long longValue)Creates a newLiteralwith the supplied long valuestatic Literalliteral(ValueFactory vf, short shortValue)Creates a newLiteralwith the supplied short valuestatic Literalliteral(ValueFactory vf, java.lang.Object object, boolean failOnUnknownType)static Literalliteral(ValueFactory vf, java.lang.String lexicalValue)Creates a newLiteralwith the supplied lexical value.static Literalliteral(ValueFactory vf, java.lang.String lexicalValue, java.lang.String languageTag)Creates a newLiteralwith the supplied lexical value.static Literalliteral(ValueFactory vf, java.lang.String lexicalValue, CoreDatatype datatype)Creates a newLiteralwith the supplied lexical value and datatype.static Literalliteral(ValueFactory vf, java.lang.String lexicalValue, IRI datatype)Creates a newLiteralwith the supplied lexical value and datatype.static Literalliteral(ValueFactory vf, java.math.BigDecimal bigDecimal)Creates a newLiteralwith the suppliedBigDecimalvaluestatic Literalliteral(ValueFactory vf, java.math.BigInteger bigInteger)Creates a newLiteralwith the suppliedBigIntegervaluestatic Literalliteral(ValueFactory vf, java.time.temporal.TemporalAccessor value)Creates a newLiteralwith the suppliedTemporalAccessorvaluestatic Namespacenamespace(java.lang.String prefix, java.lang.String name)Create a newNamespaceobject.static Tripletriple(Resource subject, IRI predicate, Value object)Creates a newRDF-star embedded triplewith the supplied subject, predicate, and object.static Tripletriple(Statement statement)Creates a newRDF-star embedded tripleusing the subject, predicate and object from the suppliedStatement.static Tripletriple(ValueFactory vf, Resource subject, IRI predicate, Value object)Creates a newRDF-star embedded triplewith the supplied subject, predicate, and object.static Tripletriple(ValueFactory vf, Statement statement)Creates a newRDF-star embedded tripleusing the subject, predicate and object from the suppliedStatement.
-
-
-
Field Detail
-
VALUE_FACTORY
private static final ValueFactory VALUE_FACTORY
Internal shared value factory used for creating all values. We use aValidatingValueFactoryto ensure created values are syntactically legal.
-
-
Method Detail
-
iri
public static IRI iri(java.lang.String iri) throws java.lang.IllegalArgumentException
Create a newIRIusing the supplied iri string- Parameters:
iri- a string representing a valid (absolute) iri- Returns:
- an
IRIobject for the supplied iri string. - Throws:
java.lang.NullPointerException- if the suppplied iri isnulljava.lang.IllegalArgumentException- if the supplied iri string can not be parsed as a legal IRI.
-
iri
public static IRI iri(ValueFactory vf, java.lang.String iri) throws java.lang.IllegalArgumentException
Create a newIRIusing the supplied iri string- Parameters:
vf- theValueFactoryto use for creation of the IRI.iri- a string representing a valid (absolute) iri- Returns:
- an
IRIobject for the supplied iri string. - Throws:
java.lang.NullPointerException- if any of the input parameters isnulljava.lang.IllegalArgumentException- if the supplied iri string can not be parsed as a legal IRI by the suppliedValueFactory.
-
iri
public static IRI iri(java.lang.String namespace, java.lang.String localName) throws java.lang.IllegalArgumentException
Create a newIRIusing the supplied namespace name and local name- Parameters:
namespace- the IRI's namespace namelocalName- the IRI's local name- Returns:
- an
IRIobject for the supplied IRI namespace name and localName. - Throws:
java.lang.NullPointerException- if any of the input parameters isnulljava.lang.IllegalArgumentException- if the supplied iri string can not be parsed as a legal IRI.
-
iri
public static IRI iri(Namespace namespace, java.lang.String localName) throws java.lang.IllegalArgumentException
- Parameters:
namespace- the IRI'sNamespacelocalName- the IRI's local name- Returns:
- an
IRIobject for the supplied IRI namespace and localName. - Throws:
java.lang.NullPointerException- if any of the input parameters isnulljava.lang.IllegalArgumentException- if the supplied iri string can not be parsed as a legal IRI.- Since:
- 3.6.0
-
iri
public static IRI iri(java.lang.Iterable<Namespace> namespaces, java.lang.String prefixedName) throws java.lang.IllegalArgumentException
Create a newIRIfrom a supplied prefixed name, using the suppliednamespaces- Parameters:
namespaces- the Namespaces from which to find the correct namespace to map the prefixed name toprefixedName- a prefixed name that is a shorthand for a full iri, using syntax formprefix:localName. For example,rdf:typeis a prefixed name whererdfis the prefix. If the correctNamespacedefinition is also supplied this expands to the full namespace namehttp://www.w3.org/1999/02/22-rdf-syntax-ns#, leading to a full IRIhttp://www.w3.org/1999/02/22-rdf-syntax-ns#type.- Returns:
- an
IRIobject for the supplied IRI namespace and localName. - Throws:
java.lang.NullPointerException- if any of the input parameters isnulljava.lang.IllegalArgumentException- if the supplied prefixed name can not be transformed to a legal IRI.- Since:
- 3.6.0
-
iri
public static IRI iri(ValueFactory vf, java.lang.String namespace, java.lang.String localName) throws java.lang.IllegalArgumentException
Create a newIRIusing the supplied namespace and local name- Parameters:
vf- theValueFactoryto use for creation of the IRI.namespace- the IRI's namespacelocalName- the IRI's local name- Returns:
- an
IRIobject for the supplied IRI namespace and localName. - Throws:
java.lang.NullPointerException- if any of the input parameters isnulljava.lang.IllegalArgumentException- if the supplied iri string can not be parsed as a legal IRI by the suppliedValueFactory
-
bnode
public static BNode bnode(ValueFactory vf)
Creates a newBNode- Parameters:
vf- theValueFactoryto use for creation of theBNode- Returns:
- a new
BNode - Throws:
java.lang.NullPointerException- if any of the input parameters isnull
-
bnode
public static BNode bnode(java.lang.String nodeId) throws java.lang.IllegalArgumentException
Creates a newBNodewith the supplied node identifier.- Parameters:
nodeId- the node identifier- Returns:
- a new
BNode - Throws:
java.lang.NullPointerException- if the supplied node identifier isnull.java.lang.IllegalArgumentException- if the supplied node identifier is not valid
-
bnode
public static BNode bnode(ValueFactory vf, java.lang.String nodeId) throws java.lang.IllegalArgumentException
Creates a newBNodewith the supplied node identifier.- Parameters:
vf- theValueFactoryto use for creation of theBNodenodeId- the node identifier- Returns:
- a new
BNode - Throws:
java.lang.NullPointerException- if any of the input parameters isnulljava.lang.IllegalArgumentException- if the supplied node identifier is not valid
-
literal
public static Literal literal(java.lang.String lexicalValue)
Creates a newLiteralwith the supplied lexical value.- Parameters:
lexicalValue- the lexical value for the literal- Returns:
- a new
Literalof typeXSD.STRING - Throws:
java.lang.NullPointerException- if the supplied lexical value isnull.
-
literal
public static Literal literal(ValueFactory vf, java.lang.String lexicalValue)
Creates a newLiteralwith the supplied lexical value.- Parameters:
vf- theValueFactoryto use for creation of theLiterallexicalValue- the lexical value for the literal- Returns:
- a new
Literalof typeXSD.STRING - Throws:
java.lang.NullPointerException- if any of the input parameters isnull
-
literal
public static Literal literal(java.lang.String lexicalValue, java.lang.String languageTag)
Creates a newLiteralwith the supplied lexical value.- Parameters:
lexicalValue- the lexical value for the literallanguageTag- the language tag for the literal.- Returns:
- a new
Literalof typeRDF.LANGSTRING - Throws:
java.lang.NullPointerException- if the supplied lexical value or language tag isnull.
-
literal
public static Literal literal(ValueFactory vf, java.lang.String lexicalValue, java.lang.String languageTag)
Creates a newLiteralwith the supplied lexical value.- Parameters:
vf- theValueFactoryto use for creation of theLiterallexicalValue- the lexical value for the literallanguageTag- the language tag for the literal.- Returns:
- a new
Literalof typeRDF.LANGSTRING - Throws:
java.lang.NullPointerException- if any of the input parameters isnull
-
literal
public static Literal literal(java.lang.String lexicalValue, IRI datatype) throws java.lang.IllegalArgumentException
Creates a newLiteralwith the supplied lexical value and datatype.- Parameters:
lexicalValue- the lexical value for the literaldatatype- the datatype IRI- Returns:
- a new
Literalwith the supplied lexical value and datatype - Throws:
java.lang.NullPointerException- if the supplied lexical value or datatype isnull.java.lang.IllegalArgumentException- if the supplied lexical value is not valid for the given datatype
-
literal
public static Literal literal(java.lang.String lexicalValue, CoreDatatype datatype) throws java.lang.IllegalArgumentException
Creates a newLiteralwith the supplied lexical value and datatype.- Parameters:
lexicalValue- the lexical value for the literaldatatype- the CoreDatatype- Returns:
- a new
Literalwith the supplied lexical value and datatype - Throws:
java.lang.NullPointerException- if the supplied lexical value or datatype isnull.java.lang.IllegalArgumentException- if the supplied lexical value is not valid for the given datatype
-
literal
public static Literal literal(ValueFactory vf, java.lang.String lexicalValue, IRI datatype) throws java.lang.IllegalArgumentException
Creates a newLiteralwith the supplied lexical value and datatype.- Parameters:
vf- theValueFactoryto use for creation of theLiterallexicalValue- the lexical value for the literaldatatype- the datatype IRI- Returns:
- a new
Literalwith the supplied lexical value and datatype - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.java.lang.IllegalArgumentException- if the supplied lexical value is not valid for the given datatype
-
literal
public static Literal literal(ValueFactory vf, java.lang.String lexicalValue, CoreDatatype datatype) throws java.lang.IllegalArgumentException
Creates a newLiteralwith the supplied lexical value and datatype.- Parameters:
vf- theValueFactoryto use for creation of theLiterallexicalValue- the lexical value for the literaldatatype- the CoreDatatype- Returns:
- a new
Literalwith the supplied lexical value and datatype - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.java.lang.IllegalArgumentException- if the supplied lexical value is not valid for the given datatype
-
literal
public static Literal literal(boolean booleanValue)
Creates a newLiteralwith the supplied boolean value- Parameters:
booleanValue- a boolean value- Returns:
- a
Literalof typeXSD.BOOLEANwith the supplied value
-
literal
public static Literal literal(ValueFactory vf, boolean booleanValue)
Creates a newLiteralwith the supplied boolean value- Parameters:
vf- theValueFactoryto use for creation of theLiteralbooleanValue- a boolean value- Returns:
- a
Literalof typeXSD.BOOLEANwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(byte byteValue)
Creates a newLiteralwith the supplied byte value
-
literal
public static Literal literal(ValueFactory vf, byte byteValue)
Creates a newLiteralwith the supplied byte value- Parameters:
vf- theValueFactoryto use for creation of theLiteralbyteValue- a byte value- Returns:
- a
Literalof typeXSD.BYTEwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(short shortValue)
Creates a newLiteralwith the supplied short value
-
literal
public static Literal literal(ValueFactory vf, short shortValue)
Creates a newLiteralwith the supplied short value- Parameters:
vf- theValueFactoryto use for creation of theLiteralshortValue- a short value- Returns:
- a
Literalof typeXSD.SHORTwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(int intValue)
Creates a newLiteralwith the supplied int value
-
literal
public static Literal literal(ValueFactory vf, int intValue)
Creates a newLiteralwith the supplied int value- Parameters:
vf- theValueFactoryto use for creation of theLiteralintValue- an int value- Returns:
- a
Literalof typeXSD.INTwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(long longValue)
Creates a newLiteralwith the supplied long value
-
literal
public static Literal literal(ValueFactory vf, long longValue)
Creates a newLiteralwith the supplied long value- Parameters:
vf- theValueFactoryto use for creation of theLiterallongValue- a long value- Returns:
- a
Literalof typeXSD.LONGwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(float floatValue)
Creates a newLiteralwith the supplied float value
-
literal
public static Literal literal(ValueFactory vf, float floatValue)
Creates a newLiteralwith the supplied float value- Parameters:
vf- theValueFactoryto use for creation of theLiteralfloatValue- a float value- Returns:
- a
Literalof typeXSD.FLOATwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(double doubleValue)
Creates a newLiteralwith the supplied double value- Parameters:
doubleValue- a double value- Returns:
- a
Literalof typeXSD.DOUBLEwith the supplied value
-
literal
public static Literal literal(ValueFactory vf, double doubleValue)
Creates a newLiteralwith the supplied double value- Parameters:
vf- theValueFactoryto use for creation of theLiteraldoubleValue- a double value- Returns:
- a
Literalof typeXSD.DOUBLEwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(java.math.BigDecimal bigDecimal)
Creates a newLiteralwith the suppliedBigDecimalvalue- Parameters:
bigDecimal- aBigDecimalvalue- Returns:
- a
Literalof typeXSD.DECIMALwith the supplied value - Throws:
java.lang.NullPointerException- if the supplied bigDecimal isnull.
-
literal
public static Literal literal(ValueFactory vf, java.math.BigDecimal bigDecimal)
Creates a newLiteralwith the suppliedBigDecimalvalue- Parameters:
vf- theValueFactoryto use for creation of theLiteralbigDecimal- aBigDecimalvalue- Returns:
- a
Literalof typeXSD.DECIMALwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(java.math.BigInteger bigInteger)
Creates a newLiteralwith the suppliedBigIntegervalue- Parameters:
bigInteger- aBigIntegervalue- Returns:
- a
Literalof typeXSD.INTEGERwith the supplied value - Throws:
java.lang.NullPointerException- if the supplied bigInteger isnull.
-
literal
public static Literal literal(ValueFactory vf, java.math.BigInteger bigInteger)
Creates a newLiteralwith the suppliedBigIntegervalue- Parameters:
vf- theValueFactoryto use for creation of theLiteralbigInteger- aBigIntegervalue- Returns:
- a
Literalof typeXSD.INTEGERwith the supplied value - Throws:
java.lang.NullPointerException- if any of the input parameters isnull.
-
literal
public static Literal literal(java.time.temporal.TemporalAccessor value) throws java.lang.IllegalArgumentException
Creates a newLiteralwith the suppliedTemporalAccessorvalue- Parameters:
value- aTemporalAccessorvalue.- Returns:
- a
Literalwith the supplied calendar value and the appropriateXSDdate/time datatype for the specific value. - Throws:
java.lang.NullPointerException- if the suppliedTemporalAccessorvalue isnull.java.lang.IllegalArgumentException- if value cannot be represented by an XML Schema date/time datatype
-
literal
public static Literal literal(ValueFactory vf, java.time.temporal.TemporalAccessor value) throws java.lang.IllegalArgumentException
Creates a newLiteralwith the suppliedTemporalAccessorvalue- Parameters:
vf- theValueFactoryto use for creation of theLiteralvalue- aTemporalAccessorvalue.- Returns:
- a
Literalwith the supplied calendar value and the appropriateXSDdate/time datatype for the specific value. - Throws:
java.lang.NullPointerException- if any of the input parameters isnull..java.lang.IllegalArgumentException- if value cannot be represented by an XML Schema date/time datatype
-
literal
public static Literal literal(java.lang.Object object)
Creates a new typedLiteralout of the supplied object, mapping the runtime type of the object to the appropriateXSDdatatype. If no mapping is available, the method returns a literal with the string representation of the supplied object as the value, andXSD.STRINGas the datatype.Recognized types are
Boolean,Byte,Double,Float,Integer,Long,Short,XMLGregorianCalendar,TemporalAccessorandDate.- Parameters:
object- an object to be converted to a typed literal.- Returns:
- a typed literal representation of the supplied object.
- Throws:
java.lang.NullPointerException- if the input parameter isnull..
-
literal
public static Literal literal(java.lang.Object object, boolean failOnUnknownType)
Creates a new typedLiteralout of the supplied object, mapping the runtime type of the object to the appropriateXSDdatatype.Recognized types are
Boolean,Byte,Double,Float,BigDecimal,Integer,BigInteger,Long,Short,XMLGregorianCalendar,TemporalAccessor,TemporalAmpountandDate.- Parameters:
object- an object to be converted to a typed literal.failOnUnknownType- If no mapping is available andfailOnUnknownTypeisfalsethe method returns a literal with the string representation of the supplied object as the value, andXSD.STRINGas the datatype. If set totruethe method throws anIllegalArgumentExceptionif no mapping available.- Returns:
- a typed literal representation of the supplied object.
- Throws:
java.lang.NullPointerException- if the input parameter isnull..
-
literal
public static Literal literal(ValueFactory vf, java.lang.Object object, boolean failOnUnknownType)
Creates a new typedLiteralout of the supplied object, mapping the runtime type of the object to the appropriateXSDdatatype.Recognized types are
Boolean,Byte,Double,Float,Integer,Long,Short,XMLGregorianCalendar,TemporalAccessorandDate.- Parameters:
valueFactory- theValueFactoryto use for creation of theLiteralobject- an object to be converted to a typed literal.failOnUnknownType- If no mapping is available andfailOnUnknownTypeisfalsethe method returns a literal with the string representation of the supplied object as the value, andXSD.STRINGas the datatype. If set totruethe method throws anIllegalArgumentExceptionif no mapping available.- Returns:
- a typed literal representation of the supplied object.
- Throws:
java.lang.NullPointerException- if any of the input parameters isnull.java.lang.IllegalArgumentException- iffailOnUnknownTypeis set totrueand the runtime type of the supplied object could not be mapped.
-
triple
public static Triple triple(Resource subject, IRI predicate, Value object)
Creates a newRDF-star embedded triplewith the supplied subject, predicate, and object.- Parameters:
subject- the Triple subjectpredicate- the Triple predicateobject- the Triple object- Returns:
- a
Triplewith the supplied subject, predicate, and object. - Throws:
java.lang.NullPointerException- if any of the supplied input parameters isnull.
-
triple
public static Triple triple(ValueFactory vf, Resource subject, IRI predicate, Value object)
Creates a newRDF-star embedded triplewith the supplied subject, predicate, and object.- Parameters:
vf- theValueFactoryto use for creation of theTriplesubject- the Triple subjectpredicate- the Triple predicateobject- the Triple object- Returns:
- a
Triplewith the supplied subject, predicate, and object. - Throws:
java.lang.NullPointerException- if any of the supplied input parameters isnull.
-
triple
public static Triple triple(Statement statement)
Creates a newRDF-star embedded tripleusing the subject, predicate and object from the suppliedStatement.
-
triple
public static Triple triple(ValueFactory vf, Statement statement)
Creates a newRDF-star embedded tripleusing the subject, predicate and object from the suppliedStatement.- Parameters:
vf- theValueFactoryto use for creation of theTriplestatement- theStatementfrom which to construct aTriple- Returns:
- a
Triplewith the same subject, predicate, and object as the supplied Statement. - Throws:
java.lang.NullPointerException- if any of the supplied input parameters isnull.
-
namespace
public static Namespace namespace(java.lang.String prefix, java.lang.String name)
Create a newNamespaceobject.- Parameters:
prefix- the prefix associated with the namespacename- the namespace name (typically an IRI) for the namespace.- Returns:
- a
Namespaceobject. - Since:
- 3.6.0
-
getValueFactory
public static ValueFactory getValueFactory()
Get aValueFactory.- Returns:
- a
ValueFactory.
-
createLiteralFromObject
private static Literal createLiteralFromObject(ValueFactory valueFactory, java.lang.Object object, boolean throwExceptionOnFailure) throws java.lang.IllegalArgumentException
Creates a typedLiteralout of the supplied object, mapping the runtime type of the object to the appropriate XML Schema type. If no mapping is available, the method throws an exception if the boolean parameter is true, or if it is false it returns a literal with the string representation of the supplied object as the value, andXSD.STRINGas the datatype. Recognized types areBoolean,Byte,Double,Float,Integer,Long,Short,XMLGregorianCalendar, andDate.- Parameters:
valueFactory- TheValueFactoryto use when creating the result.object- an object to be converted to a typed literal.throwExceptionOnFailure- If true throws aLiteralUtilExceptionwhen the object is not recognised. If false it returns a string typed literal based on the objects toString method.- Returns:
- a typed literal representation of the supplied object.
- Throws:
java.lang.IllegalArgumentException- If the literal could not be created.java.lang.NullPointerException- If the object was null.
-
-