public abstract class AbstractFieldValue extends Object implements FieldValue
FieldValue only leaves get() to implement. Many other
methods ('to<Some type>') are implemented by wrapping methods of Casting.| Modifier and Type | Field and Description |
|---|---|
protected static BridgeException |
CANNOTCHANGE |
protected Cloud |
cloud |
protected Node |
node |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFieldValue(Node n,
Cloud c) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canModify()
Function values cannot be changed
|
abstract Object |
get()
Returns the value as an Object.
|
Field |
getField()
Returns the Field object belonging to this value.
|
Node |
getNode()
Returns the Node to which this value belongs.
|
boolean |
isNull() |
void |
set(Object value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setBoolean(boolean value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setByte(byte[] value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setDate(Date value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setDouble(double value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setFLoat(float value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setInt(int value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setLong(long value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setNode(Node value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setObject(Object value) |
void |
setString(String value)
Function values cannot be changed, and all set-functions throw an exception.
|
void |
setXML(Document value)
Function values cannot be changed, and all set-functions throw an exception.
|
boolean |
toBoolean()
Returns the value as an boolean (
true or false). |
byte[] |
toByte()
Returns the value as a byte array.
|
Date |
toDate()
Returns the value as a
java.util.Date
If the value cannot be converted, this method returns null |
double |
toDouble()
Returns the value as a double.
|
float |
toFloat()
Returns the value as a float.
|
int |
toInt()
Returns the value as an int.
|
long |
toLong()
Returns the value as a long.
|
Node |
toNode()
Returns the value as a Node.
|
String |
toString()
Returns the value as a String.
|
Document |
toXML()
Returns the value as a
org.w3c.dom.Document
If the node value is not itself a Document, the method attempts to
attempts to convert the String value into an XML. |
Element |
toXML(Document tree)
Returns the value as a
org.w3c.dom.Element
If the node value is not itself a Document, the method attempts to
attempts to convert the String value into an XML. |
protected static BridgeException CANNOTCHANGE
protected final Node node
protected final Cloud cloud
public boolean canModify()
canModify in interface FieldValuepublic boolean isNull()
isNull in interface FieldValuepublic abstract Object get()
FieldValueget in interface FieldValuepublic Field getField()
FieldValuegetField in interface FieldValuepublic Node getNode()
FieldValuegetNode in interface FieldValuepublic boolean toBoolean()
FieldValuetrue or false).
If the actual value is a Boolean object, this call returns it's (primitive) boolean value.
If the actual value is a Number object, this call returns true
if the value is a positive, non-zero, value. In other words, values '0'
and '-1' are concidered false.
If the value is a string, this call returns true if
the value is "true" or "yes" (case-insensitive).
In all other cases (including calling byte fields), false
is returned.toBoolean in interface FieldValuepublic byte[] toByte()
FieldValuetoByte in interface FieldValuepublic float toFloat()
FieldValuetoFloat in interface FieldValuepublic double toDouble()
FieldValuetoDouble in interface FieldValuepublic long toLong()
FieldValuetoLong in interface FieldValuepublic int toInt()
FieldValuetoInt in interface FieldValuepublic Node toNode()
FieldValuenull.toNode in interface FieldValuepublic String toString()
FieldValuetoString in interface FieldValuetoString in class Objectpublic Document toXML() throws IllegalArgumentException
FieldValueorg.w3c.dom.Document
If the node value is not itself a Document, the method attempts to
attempts to convert the String value into an XML.
If the value cannot be converted, this method returns nulltoXML in interface FieldValueIllegalArgumentException - if the Field is not of type TYPE_XML.public final Element toXML(Document tree) throws IllegalArgumentException
FieldValueorg.w3c.dom.Element
If the node value is not itself a Document, the method attempts to
attempts to convert the String value into an XML.
This method fails (throws a IllegalArgumentException) if the Field is not of type TYPE_XML.
If the value cannot be converted, this method returns nulltoXML in interface FieldValuetree - the DOM Document to which the Element is added
(as the document root element)IllegalArgumentException - if the Field is not of type TYPE_XML.public Date toDate()
FieldValuejava.util.Date
If the value cannot be converted, this method returns nulltoDate in interface FieldValuepublic void set(Object value)
set in interface FieldValuevalue - set valueBridgeExceptionFieldValue.get()public void setObject(Object value)
setObject in interface FieldValuepublic void setBoolean(boolean value)
setBoolean in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toBoolean()public void setFLoat(float value)
setFLoat in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toFloat()public void setDouble(double value)
setDouble in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toDouble()public void setLong(long value)
setLong in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toLong()public void setInt(int value)
setInt in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toInt()public void setByte(byte[] value)
setByte in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toByte()public void setString(String value)
setString in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toString()public void setNode(Node value)
setNode in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toNode()public void setXML(Document value)
setXML in interface FieldValuevalue - set valueBridgeExceptionFieldValue.toXML(org.w3c.dom.Document)public void setDate(Date value)
setDate in interface FieldValuevalue - the field value as a java.util.Date DocumentBridgeExceptionFieldValue.toDate()MMBase 1.9-SNAPSHOT - ${javadoctimestamp}