org.jopendocument.dom
Enum ODValueType

java.lang.Object
  extended by java.lang.Enum<ODValueType>
      extended by org.jopendocument.dom.ODValueType
All Implemented Interfaces:
Serializable, Comparable<ODValueType>

public enum ODValueType
extends Enum<ODValueType>

A type of value, as per 16.1 "Data Types" and 6.7.1 "Variable Value Types and Values"


Enum Constant Summary
BOOLEAN
           
CURRENCY
           
DATE
           
FLOAT
          Parses to BigDecimal to return the exact number.
PERCENTAGE
           
STRING
           
TIME
           
 
Method Summary
 boolean canFormat(Class<?> toFormat)
           
abstract  String format(Object o)
           
static ODValueType forObject(Object o)
          Try to guess the value type for the passed object.
static ODValueType get(String name)
          The instance for the passed value type.
 String getName()
          The value for the value-type attribute.
 String getValueAttribute()
          The name of the value attribute for this value type.
abstract  Object parse(String s)
           
static ODValueType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ODValueType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

FLOAT

public static final ODValueType FLOAT
Parses to BigDecimal to return the exact number.


PERCENTAGE

public static final ODValueType PERCENTAGE

CURRENCY

public static final ODValueType CURRENCY

DATE

public static final ODValueType DATE

TIME

public static final ODValueType TIME

BOOLEAN

public static final ODValueType BOOLEAN

STRING

public static final ODValueType STRING
Method Detail

values

public static ODValueType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ODValueType c : ODValueType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ODValueType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getValueAttribute

public final String getValueAttribute()
The name of the value attribute for this value type.

Returns:
the value attribute, eg "boolean-value".

canFormat

public boolean canFormat(Class<?> toFormat)

format

public abstract String format(Object o)

parse

public abstract Object parse(String s)

getName

public final String getName()
The value for the value-type attribute.

Returns:
the value for the value-type attribute, eg "float".

get

public static ODValueType get(String name)
The instance for the passed value type.

Parameters:
name - the value of the value-type attribute, e.g. "date".
Returns:
the corresponding instance, never null, e.g. DATE.
Throws:
IllegalArgumentException - if name isn't a valid type.

forObject

public static ODValueType forObject(Object o)
                             throws NullPointerException
Try to guess the value type for the passed object.

Parameters:
o - the object.
Returns:
a value type capable of formatting o or null.
Throws:
NullPointerException - if o is null.


Copyright © 2010 jOpenDocument All Rights Reserved.