public abstract class Value extends Object implements Serializable
String
or DOM Element
representation for serializing it.ComplexValueExtension
to be convertible to an
object.Constructor and Description |
---|
Value() |
Modifier and Type | Method and Description |
---|---|
abstract <T> T |
as(Class<T> expectedType)
Get the value as the expected type if possible.
|
abstract <T> T |
as(Class<T> expectedType,
T defValue)
Get the value as the expected type if possible, a default value
otherwise.
|
static Value |
complex(Object value)
Create a complex value with a DOM representation for serialization.
|
boolean |
equals(Object obj) |
abstract Element |
getDOMRepresentation()
Get the value's DOM representation if applicable.
|
abstract String |
getStringRepresentation()
Get the value's string representation.
|
abstract Object |
getValue()
|
int |
hashCode() |
abstract boolean |
isEmpty()
Determines if the value is empty.
|
abstract boolean |
isRepresentedAsDOM()
Determines if the value is represented as DOM
Element for
serializing it. |
static Value |
of(Boolean bool)
Create a value from a boolean.
|
static Value |
of(Number number)
Create a value from a number.
|
static Value |
of(String str)
Create a value from a string.
|
static Value |
simple(Object value)
Create a simple value with a string representation for serialization.
|
String |
toString() |
public static final Value NULL
public static Value of(String str)
str
- the stringpublic static Value of(Boolean bool)
bool
- the boolean valuepublic static Value of(Number number)
number
- the number valuepublic static Value simple(Object value)
value
- the valuepublic static Value complex(Object value)
value
- the valuepublic abstract <T> T as(Class<T> expectedType)
expectedType
- the expected value type, this must be either
String
, DOM Element
or a complex value type
defined in the ComplexValueExtension
null
if it could
not be created/convertedpublic abstract <T> T as(Class<T> expectedType, T defValue)
expectedType
- the expected value type, this must be either
String
, DOM Element
or a complex value type
defined in the ComplexValueExtension
defValue
- the default value to use if the value is
null
or cannot be converted to the expected typepublic abstract Object getValue()
public abstract boolean isEmpty()
true
if the value is null
or another
kind of empty (e.g. empty string) depending on the value type,
false
otherwisepublic abstract boolean isRepresentedAsDOM()
Element
for
serializing it.Element
getDOMRepresentation()
,
getStringRepresentation()
public abstract Element getDOMRepresentation()
Element
representing the value or null
if
isRepresentedAsDOM()
yields false
isRepresentedAsDOM()
public abstract String getStringRepresentation()
null
if
isRepresentedAsDOM()
yields true
isRepresentedAsDOM()
Build 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a