public class PropertyLiteral extends AbstractCloneable implements PropertyObject
PropertyObject
representing a literal, like a string.
A literal always has a getLiteralValue()
and a getLiteralType()
. Note that RDF
literal string's "language" is not yet supported.
Plain old strings should have the default setLiteralType(URI)
of XSD_STRING
.
For known XSD types like and XSD_NORMALIZEDSTRING
, the
corresponding setLiteralType(URI)
should be set.
Some primitive Java types can be set directly by using constructors like
PropertyLiteral(double)
and PropertyLiteral(boolean)
, and retrieved using
methods like getLiteralValueAsDouble()
and getLiteralValueAsBoolean()
.
See DatatypeConverter
to convert other XML types not covered by this class.
Values which are XML should have the type set to avoid double-escaped serialisation.
DatatypeConverter
AbstractCloneable.Cloning, AbstractCloneable.CopyVisitor
Constructor and Description |
---|
PropertyLiteral()
Constructs a
PropertyLiteral with no value or type. |
PropertyLiteral(boolean b)
Constructs a
PropertyLiteral with the specified value and a type of
XSD_BOOLEAN |
PropertyLiteral(Calendar cal)
Constructs a
PropertyLiteral with the specified value and a type of
XSD_DATETIME |
PropertyLiteral(double d)
Constructs a
PropertyLiteral with the specified value and a type of
XSD_DOUBLE |
PropertyLiteral(Element element)
Constructs a
PropertyLiteral with the specified value and a type of
XML_LITERAL |
PropertyLiteral(float f)
Constructs a
PropertyLiteral with the specified value and a type of
XSD_FLOAT |
PropertyLiteral(int i)
Constructs a
PropertyLiteral with the specified value and a type of
XSD_INT |
PropertyLiteral(long l)
Constructs a
PropertyLiteral with the specified value and a type of
XSD_LONG |
PropertyLiteral(String value)
Constructs a
PropertyLiteral with the specified value and a type of
XSD_BOOLEAN |
PropertyLiteral(String value,
URI literalType)
Constructs a
PropertyLiteral with the specified value and type. |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Visitor visitor)
Accepts a
Visitor to this WorkflowBean . |
protected void |
cloneInto(WorkflowBean clone,
AbstractCloneable.Cloning cloning) |
protected static DocumentBuilder |
getDocumentBuilder() |
static DocumentBuilderFactory |
getDocumentBuilderFactory() |
URI |
getLiteralType()
Returns the literal type.
|
String |
getLiteralValue()
Returns the literal value as a
String . |
boolean |
getLiteralValueAsBoolean()
Returns the literal value as a
boolean . |
Calendar |
getLiteralValueAsCalendar()
Returns the literal value as a
Calendar . |
double |
getLiteralValueAsDouble()
Returns the literal value as a
double . |
Element |
getLiteralValueAsElement()
Returns the literal value as an XML
Element . |
float |
getLiteralValueAsFloat()
Returns the literal value as a
float . |
int |
getLiteralValueAsInt()
Returns the literal value as a
int . |
long |
getLiteralValueAsLong()
Returns the literal value as a
long . |
protected static Transformer |
getTransformer() |
static TransformerFactory |
getTransformerFactory() |
void |
setDocumentBuilderFactory(DocumentBuilderFactory documentBuilderFactory) |
void |
setLiteralType(URI literalType)
Sets the literal type.
|
void |
setLiteralValue(String literalValue)
Sets the literal value.
|
void |
setTransformerFactory(TransformerFactory transformerFactory) |
String |
toString() |
clone, cloneWorkflowBean
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clone
public static URI XSD
public static URI XSD_STRING
public static URI XSD_BOOLEAN
public static URI XSD_DECIMAL
public static URI XSD_FLOAT
public static URI XSD_DOUBLE
public static URI XSD_DURATION
public static URI XSD_DATETIME
public static URI XSD_TIME
public static URI XSD_DATE
public static URI XSD_YEARMONTH
public static URI XSD_YEAR
public static URI XSD_MONTHDAY
public static URI XSD_DAY
public static URI XSD_MONTH
public static URI XSD_HEXBINARY
public static URI XSD_BASE64BINARY
public static URI XSD_ANYURI
public static URI XSD_QNAME
public static URI XSD_NORMALIZEDSTRING
public static URI XSD_TOKEN
public static URI XSD_LANGUAGE
public static URI XSD_NMTOKEN
public static URI XSD_NMTOKENS
public static URI XSD_NAME
public static URI XSD_NCNAME
public static URI XSD_ID
public static URI XSD_IDREF
public static URI XSD_IDREFS
public static URI XSD_ENTITY
public static URI XSD_ENTITIES
public static URI XSD_INTEGER
public static URI XSD_NONPOSITIVEINTEGER
public static URI XSD_NEGATIVEINTEGER
public static URI XSD_LONG
public static URI XSD_INT
public static URI XSD_SHORT
public static URI XSD_BYTE
public static URI XSD_NONNEGATIVEINTEGER
public static URI XSD_UNSIGNEDLONG
public static URI XSD_UNSIGNEDINT
public static URI XSD_UNSIGNEDSHORT
public static URI XSD_UNSIGNEDBYTE
public static URI XSD_POSITIVEINTEGER
public static URI XML_LITERAL
public PropertyLiteral()
PropertyLiteral
with no value or type.public PropertyLiteral(boolean b)
PropertyLiteral
with the specified value and a type of
XSD_BOOLEAN
b
- the literal valuepublic PropertyLiteral(Calendar cal)
PropertyLiteral
with the specified value and a type of
XSD_DATETIME
cal
- the literal value. Must not be nullpublic PropertyLiteral(double d)
PropertyLiteral
with the specified value and a type of
XSD_DOUBLE
d
- the literal valuepublic PropertyLiteral(Element element)
PropertyLiteral
with the specified value and a type of
XML_LITERAL
element
- the literal value. Must not be nullpublic PropertyLiteral(float f)
PropertyLiteral
with the specified value and a type of
XSD_FLOAT
f
- the literal valuepublic PropertyLiteral(int i)
PropertyLiteral
with the specified value and a type of
XSD_INT
i
- the literal valuepublic PropertyLiteral(long l)
PropertyLiteral
with the specified value and a type of
XSD_LONG
l
- the literal valuepublic PropertyLiteral(String value)
PropertyLiteral
with the specified value and a type of
XSD_BOOLEAN
value
- the literal value. Must not be nullpublic static DocumentBuilderFactory getDocumentBuilderFactory()
public void setDocumentBuilderFactory(DocumentBuilderFactory documentBuilderFactory)
public static TransformerFactory getTransformerFactory()
public void setTransformerFactory(TransformerFactory transformerFactory)
protected static DocumentBuilder getDocumentBuilder()
protected static Transformer getTransformer()
public boolean accept(Visitor visitor)
WorkflowBean
Visitor
to this WorkflowBean
.accept
in interface WorkflowBean
visitor
- the Visitor
to accepttrue
if this WorkflowBeans
children should be visited.public URI getLiteralType()
public String getLiteralValue()
String
.String
public boolean getLiteralValueAsBoolean()
boolean
.boolean
public Calendar getLiteralValueAsCalendar()
Calendar
.Calendar
public double getLiteralValueAsDouble()
double
.double
public Element getLiteralValueAsElement()
Element
.Element
public float getLiteralValueAsFloat()
float
.float
public int getLiteralValueAsInt()
int
.int
public long getLiteralValueAsLong()
long
.long
public void setLiteralType(URI literalType)
literalType
- the literal type. Must not be nullpublic void setLiteralValue(String literalValue)
literalValue
- the literal value. Must not be nullprotected void cloneInto(WorkflowBean clone, AbstractCloneable.Cloning cloning)
cloneInto
in class AbstractCloneable
Copyright © 2013 myGrid. All rights reserved.