Modifier and Type | Field and Description |
---|---|
static DataType |
All
Represents the type of all data; a widget that can accept this data type can accept data of any
type.
|
static DataType<java.lang.Boolean> |
Boolean
The type corresponding to boolean data.
|
static DataType<boolean[]> |
BooleanArray
The type corresponding to a boolean array (boolean[]).
|
static DataType<byte[]> |
ByteArray
The type corresponding to an array of raw bytes (byte[]).
|
static ComplexDataType<MapData> |
Map |
static DataType |
None
Represents the type of "null" or non-present data.
|
static DataType<java.lang.Number> |
Number
The type corresponding to numeric data.
|
static DataType<double[]> |
NumberArray
The type corresponding to an array of numeric data (double[]).
|
static DataType<java.lang.String> |
String
The type corresponding to text data.
|
static DataType<java.lang.String[]> |
StringArray
The type corresponding to an array of strings (String[]).
|
static DataType |
Unknown
Represents an "unknown" data type; that is, data is present, but the type could not be determined.
|
Constructor and Description |
---|
DataTypes()
Creates a new data type registry.
|
Modifier and Type | Method and Description |
---|---|
<T> java.util.Optional<DataType<T>> |
forJavaType(java.lang.Class<T> type)
Gets the data type most relevant to a Java class.
|
java.util.Set<DataType> |
forJavaTypes(java.lang.Class<?>... types)
Gets a set of registered data types that can handle data of the supplied Java types.
|
java.util.Optional<DataType> |
forName(java.lang.String name)
Gets the data type with the given name.
|
<D extends DataType> |
forType(java.lang.Class<D> clazz)
Gets the registered data type of the given class.
|
java.util.Set<DataType> |
forTypes(java.lang.Class<? extends DataType>... types)
Gets the registered data types of the given types.
|
static DataTypes |
getDefault()
Gets the default data type registry.
|
static boolean |
isCompatible(DataType type,
java.util.Collection<? extends DataType> types) |
void |
register(DataType dataType)
Registers the given data type.
|
static void |
setDefault(DataTypes instance)
Sets the default instance to use.
|
void |
unregister(DataType dataType)
Unregisters an item from this registry.
|
addItem, getItems, isRegistered, registerAll, registerAll, registerIfAbsent, removeItem, unregisterAll, unregisterAll
public static final DataType None
UnknownType
in that no data is
present for this type, while data is present but of an unknown type for the latter.public static final DataType All
public static final DataType Unknown
public static final ComplexDataType<MapData> Map
public static final DataType<java.lang.Boolean> Boolean
public static final DataType<boolean[]> BooleanArray
public static final DataType<java.lang.Number> Number
public static final DataType<double[]> NumberArray
public static final DataType<java.lang.String> String
public static final DataType<java.lang.String[]> StringArray
public static final DataType<byte[]> ByteArray
public DataTypes()
public static DataTypes getDefault()
public static void setDefault(DataTypes instance)
java.lang.IllegalStateException
- if not called from a testpublic void register(DataType dataType)
public void unregister(DataType dataType)
Registry
unregister
in class Registry<DataType>
dataType
- the item to unregisterpublic java.util.Optional<DataType> forName(java.lang.String name)
public <T> java.util.Optional<DataType<T>> forJavaType(java.lang.Class<T> type)
public java.util.Set<DataType> forJavaTypes(java.lang.Class<?>... types)
forJavaType(java.lang.Class<T>)
public <D extends DataType> java.util.Optional<D> forType(java.lang.Class<D> clazz)
public java.util.Set<DataType> forTypes(java.lang.Class<? extends DataType>... types)