public class ElementValue extends Value
Element
.Constructor and Description |
---|
ElementValue(Element element,
Object context)
Create a value based on a DOM element.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
as(Class<T> expectedType)
Get the value as the expected type if possible.
|
<T> T |
as(Class<T> expectedType,
T defValue)
Get the value as the expected type if possible, a default value
otherwise.
|
Element |
getDOMRepresentation()
Get the value's DOM representation if applicable.
|
String |
getStringRepresentation()
Get the value's string representation.
|
Object |
getValue()
|
boolean |
isEmpty()
Determines if the value is empty.
|
boolean |
isRepresentedAsDOM()
Determines if the value is represented as DOM
Element for
serializing it. |
public <T> T as(Class<T> expectedType)
Value
as
in class Value
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 boolean isEmpty()
Value
public boolean isRepresentedAsDOM()
Value
Element
for
serializing it.isRepresentedAsDOM
in class Value
Element
Value.getDOMRepresentation()
,
Value.getStringRepresentation()
public Element getDOMRepresentation()
Value
getDOMRepresentation
in class Value
Element
representing the value or null
if
Value.isRepresentedAsDOM()
yields false
Value.isRepresentedAsDOM()
public String getStringRepresentation()
Value
getStringRepresentation
in class Value
null
if
Value.isRepresentedAsDOM()
yields true
Value.isRepresentedAsDOM()
public <T> T as(Class<T> expectedType, T defValue)
Value
as
in class Value
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 typeBuild 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a