|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.http.representation.ValueBase
info.sswap.http.representation.LiteralValue
public class LiteralValue
Represents a value (e.g., of a property) in the intermediate representation.
Field Summary | |
---|---|
private java.lang.String |
datatype
An optional information about the datatype. |
private java.lang.String |
internalRepresentation
The internal representation of the value as string. |
Constructor Summary | |
---|---|
LiteralValue(java.lang.String datatype,
boolean value)
Creates a new value object initialized with a boolean value. |
|
LiteralValue(java.lang.String datatype,
double value)
Creates a new value object initialized with a double value |
|
LiteralValue(java.lang.String datatype,
int value)
Creates a new value object initialized with an integer value |
|
LiteralValue(java.lang.String datatype,
java.lang.String string)
Creates a new value and initializes it with the given string value. |
Method Summary | |
---|---|
boolean |
asBoolean()
Gets the boolean representation of this value |
double |
asDouble()
Returns the representation of this value as a double |
int |
asInteger()
Returns the representation of this value as an integer |
LiteralValue |
asLiteral()
Returns this value as a literal. |
java.lang.String |
asString()
Returns the representation of this value as string (without the quotes). |
java.lang.String |
getDatatype()
Gets the URI of the datatype (may be null) |
boolean |
isBoolean()
Checks whether this value can be as a boolean (i.e., contains "true" or "false", case insensitive) |
boolean |
isDouble()
Checks whether this value can be represented as a double |
boolean |
isInteger()
Checks whether this value is a valid integer. |
boolean |
isLiteral()
Checks whether this value is a literal (i.e., not an array or entity) |
void |
setDatatype(java.lang.String datatype)
Sets the URI of the datatype |
Methods inherited from class info.sswap.http.representation.ValueBase |
---|
asArray, asEntity, isArray, isEntity |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String datatype
private java.lang.String internalRepresentation
Constructor Detail |
---|
public LiteralValue(java.lang.String datatype, java.lang.String string)
datatype
- the URI of the datatype or nullstring
- the string value or nullpublic LiteralValue(java.lang.String datatype, boolean value)
datatype
- the URI of the datatype or nullvalue
- the boolean valuepublic LiteralValue(java.lang.String datatype, int value)
datatype
- the URI of the datatype or nullvalue
- the integer valuepublic LiteralValue(java.lang.String datatype, double value)
datatype
- the URI of the datatype or nullvalue
- the double valueMethod Detail |
---|
public java.lang.String getDatatype()
public void setDatatype(java.lang.String datatype)
datatype
- the new URI of the datatype or nullpublic boolean isLiteral()
Value
isLiteral
in interface Value
isLiteral
in class ValueBase
public LiteralValue asLiteral()
Value
asLiteral
in interface Value
asLiteral
in class ValueBase
public java.lang.String asString()
Value
asString
in interface Value
asString
in class ValueBase
public boolean isInteger()
Value
isInteger
in interface Value
isInteger
in class ValueBase
public int asInteger() throws java.lang.IllegalArgumentException
Value
asInteger
in interface Value
asInteger
in class ValueBase
java.lang.IllegalArgumentException
- if this value cannot be represented as an integer (isInteger() should return false in such a case)public boolean isDouble()
Value
isDouble
in interface Value
isDouble
in class ValueBase
public double asDouble() throws java.lang.IllegalArgumentException
Value
asDouble
in interface Value
asDouble
in class ValueBase
java.lang.IllegalArgumentException
- if this value cannot be represented as a double (isDouble() should return false in such a case)public boolean isBoolean()
Value
isBoolean
in interface Value
isBoolean
in class ValueBase
public boolean asBoolean()
Value
asBoolean
in interface Value
asBoolean
in class ValueBase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |