public abstract class PropertyType<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
static PropertyType<Boolean> |
BOOLEAN |
static PropertyType<Date> |
DATETIME |
static PropertyType<Double> |
DOUBLE |
static PropertyType<Integer> |
INTEGER |
static PropertyType<Object> |
JSON |
static PropertyType<Long> |
LONG |
static PropertyType<String> |
STRING |
static TimeZone |
UTC
The UTC time zone.
|
| Modifier | Constructor and Description |
|---|---|
protected |
PropertyType(String name)
Basic constructor to derive from.
|
| Modifier and Type | Method and Description |
|---|---|
abstract T |
cast(Object value)
Casts a value according to this type.
|
String |
format(Object value)
Formats a value according to this type.
|
static PropertyType<?> |
get(String name) |
String |
getName() |
abstract T |
parse(String str)
Parses a string according to this type.
|
T |
read(DataInput in)
Reads a value according to this type.
|
static boolean |
register(PropertyType<?> type)
Registers a property type.
|
String |
toString() |
void |
write(DataOutput out,
T value)
Writes a value according to this type.
|
public static final TimeZone UTC
public static final PropertyType<String> STRING
public static final PropertyType<Boolean> BOOLEAN
public static final PropertyType<Integer> INTEGER
public static final PropertyType<Long> LONG
public static final PropertyType<Date> DATETIME
public static final PropertyType<Double> DOUBLE
public static final PropertyType<Object> JSON
protected PropertyType(String name)
name - the type namepublic static PropertyType<?> get(String name)
name - the type namepublic static boolean register(PropertyType<?> type)
type - the typeIllegalArgumentException - if a type with the same name has already been registeredpublic String getName()
public abstract T cast(Object value)
value - a valuepublic abstract T parse(String str)
str - a valuepublic String format(Object value)
value - a valuepublic void write(DataOutput out, T value) throws IOException
out - a data outputvalue - a valueIOException - if write failspublic T read(DataInput in) throws IOException
in - a data inputIOExceptionCopyright © 2024 The Apache Software Foundation. All rights reserved.