com.google.visualization.datasource.datatable.value
Class Value

java.lang.Object
  extended by com.google.visualization.datasource.datatable.value.Value
All Implemented Interfaces:
java.lang.Comparable<Value>
Direct Known Subclasses:
BooleanValue, DateTimeValue, DateValue, NumberValue, TextValue, TimeOfDayValue

public abstract class Value
extends java.lang.Object
implements java.lang.Comparable<Value>

An abstract value of a single cell in a table. Acts as a base class for all the typed value classes. A value should be an immutable class, because it is reference-copied when cloning complex objects like rows or whole tables.

Author:
Itai R.

Constructor Summary
Value()
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks if this object is equal to the given object.
static java.util.Comparator<Value> getLocalizedComparator(com.ibm.icu.util.ULocale ulocale)
          Returns a comparator that compares values according to a given locale (in case of text values).
static Value getNullValueFromValueType(ValueType type)
          Returns the NullValue for the given type.
abstract  java.lang.Object getObjectToFormat()
          Uses an ibm.icu.text.UFormat instance to format Values.
abstract  ValueType getType()
          Returns the type of this cell.
abstract  int hashCode()
          Returns the hashcode of this value.
protected abstract  java.lang.String innerToQueryString()
          Returns a string that, when parsed by the query parser, should return an identical value.
abstract  boolean isNull()
          Returns whether or not this cell's value is a logical null.
 java.lang.String toQueryString()
          Returns a string that, when parsed by the query parser, should return an identical value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

Value

public Value()
Method Detail

getType

public abstract ValueType getType()
Returns the type of this cell.

Returns:
The type of this cell.

isNull

public abstract boolean isNull()
Returns whether or not this cell's value is a logical null.

Returns:
true iff this cell's value is a logical null.

equals

public boolean equals(java.lang.Object o)
Checks if this object is equal to the given object. Note that no instance can be equal to null and two instances of different classes are not equal.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object with which to compare.
Returns:
true if this equals o and false otherwise.

hashCode

public abstract int hashCode()
Returns the hashcode of this value. This is introduced here to force the subclasses to define this function.

Overrides:
hashCode in class java.lang.Object
Returns:
The hashcode of this value.

getObjectToFormat

public abstract java.lang.Object getObjectToFormat()
Uses an ibm.icu.text.UFormat instance to format Values. The following method returns an object representing this Value that a UFormat can format.

Returns:
An object representing this value that can be formatted by a UFormat formatter, null for a NULL_VALUE.

getNullValueFromValueType

public static Value getNullValueFromValueType(ValueType type)
Returns the NullValue for the given type.

Parameters:
type - The value type.
Returns:
The NullValue for the given type.

toQueryString

public final java.lang.String toQueryString()
Returns a string that, when parsed by the query parser, should return an identical value. Throws an exception when called on a null value.

Returns:
A string form of this value.

innerToQueryString

protected abstract java.lang.String innerToQueryString()
Returns a string that, when parsed by the query parser, should return an identical value. Assumes this value is not null.

Returns:
A string form of this value.

getLocalizedComparator

public static java.util.Comparator<Value> getLocalizedComparator(com.ibm.icu.util.ULocale ulocale)
Returns a comparator that compares values according to a given locale (in case of text values).

Parameters:
ulocale - The ULocale defining the order relation of text values.
Returns:
A comparator that compares values according to a given locale (in case of text values).


Copyright © 2009 Google. All Rights Reserved.