|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcsheets.core.Value
public class Value
A typed value that a cell can contain.
| Nested Class Summary | |
|---|---|
static class |
Value.Type
The recognized types of values |
| Constructor Summary | |
|---|---|
Value()
Creates a null value. |
|
Value(Boolean booleanValue)
Creates a boolean value. |
|
Value(Date date)
Creates a date value. |
|
Value(Number number)
Creates a numeric value. |
|
Value(String text)
Creates a text value. |
|
Value(Throwable error)
Creates an error value. |
|
Value(Value[] matrix)
Creates a one-dimensional matrix value (vector). |
|
Value(Value[][] matrix)
Creates a two-dimensional matrix value. |
|
| Method Summary | |
|---|---|
int |
compareTo(Value otherValue)
Compares this value with the given value for order. |
boolean |
equals(Object other)
Returns whether the other object is an identical value . |
Value.Type |
getType()
Returns the type of the value. |
boolean |
isOfType(Value.Type type)
Returns whether the value is of the given type. |
static Value |
parseBooleanValue(String value)
Attempts to parse a boolean from the given string. |
static Value |
parseDateValue(String value)
Attempts to parse a date, time or date/time from the given string. |
static Value |
parseNumericValue(String value)
Attempts to parse a number from the given string. |
static Value |
parseValue(String value,
Value.Type... types)
Attempts to parse a value from the given string. |
Object |
toAny()
Returns the value in untyped form. |
Boolean |
toBoolean()
Returns a boolean representation of the value. |
Date |
toDate()
Returns a date representation of the value. |
double |
toDouble()
Returns a primitive numeric representation of the value. |
Throwable |
toError()
Returns an error representation of the value. |
Value[][] |
toMatrix()
Returns a matrix representation of the value. |
Number |
toNumber()
Returns a numeric representation of the value. |
String |
toString()
Returns a string representation of the value. |
String |
toString(Format format)
Returns a string representation of the value, using the given date or number format. |
String |
toText()
Returns a text representation of the value. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Value()
public Value(Number number)
number - the number of the valuepublic Value(String text)
text - the text of the valuepublic Value(Boolean booleanValue)
booleanValue - the boolean of the valuepublic Value(Date date)
date - the date of the valuepublic Value(Value[] matrix)
matrix - the value vectorpublic Value(Value[][] matrix)
matrix - the value matrixpublic Value(Throwable error)
error - the error of the value| Method Detail |
|---|
public final Object toAny()
public final Value.Type getType()
public final boolean isOfType(Value.Type type)
type - the type of value to check against
public Number toNumber()
throws IllegalValueTypeException
IllegalValueTypeException - if the value cannot be converted to this type
public double toDouble()
throws IllegalValueTypeException
IllegalValueTypeException - if the value cannot be converted to this type
public String toText()
throws IllegalValueTypeException
IllegalValueTypeException - if the value cannot be converted to this type
public Boolean toBoolean()
throws IllegalValueTypeException
IllegalValueTypeException - if the value cannot be converted to this type
public Date toDate()
throws IllegalValueTypeException
IllegalValueTypeException - if the value cannot be converted to this type
public Value[][] toMatrix()
throws IllegalValueTypeException
IllegalValueTypeException - if the value cannot be converted to this type
public Throwable toError()
throws IllegalValueTypeException
IllegalValueTypeException - if the value cannot be converted to this typepublic int compareTo(Value otherValue)
compareTo in interface Comparable<Value>otherValue - the value to compare to
public boolean equals(Object other)
equals in class Objectother - the object to check for equality
public String toString()
toString in class Objectpublic String toString(Format format)
format - the format to use when converting the value
public static Value parseValue(String value,
Value.Type... types)
value - the valuetypes - the types for which parsing should be attempted
public static Value parseNumericValue(String value)
throws ParseException
value - the value
IllegalValueTypeException - if no numeric value was found
ParseException
public static Value parseBooleanValue(String value)
throws ParseException
value - the value
IllegalValueTypeException - if no boolean value was found
ParseException
public static Value parseDateValue(String value)
throws ParseException
value - the value
IllegalValueTypeException - if no date value was found
ParseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||