|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.bridge.implementation.BasicFieldValue
public class BasicFieldValue
This is the basic implementation of the Field Value interface.
| Constructor Summary | |
|---|---|
BasicFieldValue(Node node,
Field field)
|
|
| Method Summary | |
|---|---|
boolean |
canModify()
Returns whether this value can be changed. |
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)
Sets the value, passing any Object The object type may vary and is generally stored in memory as-is, which means that, generally, the get() method returns the same object. |
void |
setBoolean(boolean value)
Sets the value, passing a boolean value. |
void |
setByte(byte[] value)
Sets the value, passing a byte array. |
void |
setDate(Date value)
Sets the value, passing a java.util.Date object. |
void |
setDouble(double value)
Sets the value, passing a double value. |
void |
setFLoat(float value)
Sets the value, passing a float value. |
void |
setInt(int value)
Sets the value, passing a int value. |
void |
setLong(long value)
Sets the value, passing a long value. |
void |
setNode(Node value)
Sets the value, passing a Node. |
void |
setObject(Object value)
|
void |
setString(String value)
Sets the value, passing a String. |
void |
setXML(Document value)
Sets the value, passing a org.w3c.dom.Document object. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BasicFieldValue(Node node,
Field field)
| Method Detail |
|---|
public boolean canModify()
FieldValue
canModify in interface FieldValuetrue if the value can be changedpublic boolean isNull()
isNull in interface FieldValuepublic Object get()
FieldValue
get in interface FieldValuepublic Field getField()
FieldValue
getField in interface FieldValuepublic Node getNode()
FieldValue
getNode 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()
FieldValue
toByte in interface FieldValuepublic float toFloat()
FieldValue
toFloat in interface FieldValuepublic double toDouble()
FieldValue
toDouble in interface FieldValuepublic long toLong()
FieldValue
toLong in interface FieldValuepublic int toInt()
FieldValue
toInt in interface FieldValuepublic Node toNode()
FieldValuenull.
toNode in interface FieldValuepublic String toString()
FieldValue
toString in interface FieldValuetoString in class Object
public 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 null
toXML in interface FieldValueIllegalArgumentException - if the Field is not of type TYPE_XML.
public 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 null
toXML 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 null
toDate in interface FieldValuepublic void set(Object value)
FieldValue
set in interface FieldValuevalue - the field value as an ObjectFieldValue.get()public void setObject(Object value)
setObject in interface FieldValuepublic void setBoolean(boolean value)
FieldValue
setBoolean in interface FieldValuevalue - the field value as a booleanFieldValue.toBoolean()public void setFLoat(float value)
FieldValue
setFLoat in interface FieldValuevalue - the field value as a floatFieldValue.toFloat()public void setDouble(double value)
FieldValue
setDouble in interface FieldValuevalue - the field value as a doubleFieldValue.toDouble()public void setLong(long value)
FieldValue
setLong in interface FieldValuevalue - the field value as a longFieldValue.toLong()public void setInt(int value)
FieldValue
setInt in interface FieldValuevalue - the field value as a intFieldValue.toInt()public void setByte(byte[] value)
FieldValue
setByte in interface FieldValuevalue - the field value as a byte arrayFieldValue.toByte()public void setString(String value)
FieldValue
setString in interface FieldValuevalue - the field value as a StringFieldValue.toString()public void setNode(Node value)
FieldValue
setNode in interface FieldValuevalue - the field value as a NodeFieldValue.toNode()public void setXML(Document value)
FieldValue
setXML in interface FieldValuevalue - the field value as a XML DocumentFieldValue.toXML(org.w3c.dom.Document)public void setDate(Date value)
FieldValue
setDate in interface FieldValuevalue - the field value as a java.util.Date DocumentFieldValue.toDate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||