org.deegree.commons.tom.primitive
Class PrimitiveValue

java.lang.Object
  extended by org.deegree.commons.tom.primitive.PrimitiveValue
All Implemented Interfaces:
Comparable<PrimitiveValue>, TypedObjectNode

public class PrimitiveValue
extends Object
implements TypedObjectNode, Comparable<PrimitiveValue>

TypedObjectNode that represents a typed primitive value, e.g. an XML text node or an XML attribute value with type information. TODO Should the aspect of textual representation of the value really be reflected here?

Version:
$Revision: 30573 $, $Date: 2011-04-27 17:33:13 +0200 (Wed, 27 Apr 2011) $
Author:
Markus Schneider, last edited by: $Author: mschneider $
See Also:
BaseType

Constructor Summary
PrimitiveValue(Object value)
          Deprecated. 
PrimitiveValue(Object value, PrimitiveType type)
           
PrimitiveValue(Object value, String textValue, PrimitiveType type)
          Creates a new PrimitiveValue instance.
PrimitiveValue(String value, PrimitiveType type)
           
 
Method Summary
 int compareTo(PrimitiveValue o)
           
 boolean equals(Object o)
           
 String getAsText()
          Returns the text representation of the value.
 PrimitiveType getType()
          Returns the type of the value.
 Object getValue()
          Returns the canonical object representation of the value.
 int hashCode()
           
static Pair<Object,Object> makeComparable(Object value1, Object value2)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrimitiveValue

public PrimitiveValue(Object value,
                      String textValue,
                      PrimitiveType type)
               throws IllegalArgumentException
Creates a new PrimitiveValue instance.

Parameters:
value - object value, must not be null and correspond to type
textValue - textual representation of the value, can be null (auto-generated from value)
type - primitive type, must not be null
Throws:
IllegalArgumentException

PrimitiveValue

public PrimitiveValue(Object value,
                      PrimitiveType type)
               throws IllegalArgumentException
Throws:
IllegalArgumentException

PrimitiveValue

public PrimitiveValue(String value,
                      PrimitiveType type)
               throws IllegalArgumentException
Parameters:
value -
type -
Throws:
IllegalArgumentException

PrimitiveValue

@Deprecated
public PrimitiveValue(Object value)
               throws IllegalArgumentException
Deprecated. 

Parameters:
value -
Throws:
IllegalArgumentException
Method Detail

getValue

public Object getValue()
Returns the canonical object representation of the value.

Returns:
the canonical object representation of the value, never null

getAsText

public String getAsText()
Returns the text representation of the value.

Returns:
the text representation of the value, never null

getType

public PrimitiveType getType()
Returns the type of the value.

Returns:
the type of the value, never null

compareTo

public int compareTo(PrimitiveValue o)
Specified by:
compareTo in interface Comparable<PrimitiveValue>

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

makeComparable

public static Pair<Object,Object> makeComparable(Object value1,
                                                 Object value2)
                                          throws IllegalArgumentException
Parameters:
value1 -
value2 -
Returns:
should be a ComparablePair now that we have it...
Throws:
IllegalArgumentException


Copyright © 2011. All Rights Reserved.