public class ConfigurationSerialization
extends java.lang.Object
Configuration
.Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
SERIALIZED_TYPE_KEY |
Modifier | Constructor | Description |
---|---|---|
protected |
ConfigurationSerialization(java.lang.Class<? extends ConfigurationSerializable> clazz) |
Modifier and Type | Method | Description |
---|---|---|
ConfigurationSerializable |
deserialize(java.util.Map<java.lang.String,?> args) |
|
static ConfigurationSerializable |
deserializeObject(java.util.Map<java.lang.String,?> args) |
Attempts to deserialize the given arguments into a new instance of the
given class.
|
static ConfigurationSerializable |
deserializeObject(java.util.Map<java.lang.String,?> args,
java.lang.Class<? extends ConfigurationSerializable> clazz) |
Attempts to deserialize the given arguments into a new instance of the
given class.
|
protected ConfigurationSerializable |
deserializeViaCtor(java.lang.reflect.Constructor<? extends ConfigurationSerializable> ctor,
java.util.Map<java.lang.String,?> args) |
|
protected ConfigurationSerializable |
deserializeViaMethod(java.lang.reflect.Method method,
java.util.Map<java.lang.String,?> args) |
|
static java.lang.String |
getAlias(java.lang.Class<? extends ConfigurationSerializable> clazz) |
Gets the correct alias for the given
ConfigurationSerializable
class |
static java.lang.Class<? extends ConfigurationSerializable> |
getClassByAlias(java.lang.String alias) |
Attempts to get a registered
ConfigurationSerializable class by
its alias |
protected java.lang.reflect.Constructor<? extends ConfigurationSerializable> |
getConstructor() |
|
protected java.lang.reflect.Method |
getMethod(java.lang.String name,
boolean isStatic) |
|
static void |
registerClass(java.lang.Class<? extends ConfigurationSerializable> clazz) |
Registers the given
ConfigurationSerializable class by its
alias |
static void |
registerClass(java.lang.Class<? extends ConfigurationSerializable> clazz,
java.lang.String alias) |
Registers the given alias to the specified
ConfigurationSerializable class |
static void |
unregisterClass(java.lang.Class<? extends ConfigurationSerializable> clazz) |
Unregisters any aliases for the specified
ConfigurationSerializable class |
static void |
unregisterClass(java.lang.String alias) |
Unregisters the specified alias to a
ConfigurationSerializable |
public static final java.lang.String SERIALIZED_TYPE_KEY
protected ConfigurationSerialization(java.lang.Class<? extends ConfigurationSerializable> clazz)
protected java.lang.reflect.Method getMethod(java.lang.String name, boolean isStatic)
protected java.lang.reflect.Constructor<? extends ConfigurationSerializable> getConstructor()
protected ConfigurationSerializable deserializeViaMethod(java.lang.reflect.Method method, java.util.Map<java.lang.String,?> args)
protected ConfigurationSerializable deserializeViaCtor(java.lang.reflect.Constructor<? extends ConfigurationSerializable> ctor, java.util.Map<java.lang.String,?> args)
public ConfigurationSerializable deserialize(java.util.Map<java.lang.String,?> args)
public static ConfigurationSerializable deserializeObject(java.util.Map<java.lang.String,?> args, java.lang.Class<? extends ConfigurationSerializable> clazz)
The class must implement ConfigurationSerializable
, including
the extra methods as specified in the javadoc of
ConfigurationSerializable.
If a new instance could not be made, an example being the class not fully implementing the interface, null will be returned.
args
- Arguments for deserializationclazz
- Class to deserialize intopublic static ConfigurationSerializable deserializeObject(java.util.Map<java.lang.String,?> args)
The class must implement ConfigurationSerializable
, including
the extra methods as specified in the javadoc of
ConfigurationSerializable.
If a new instance could not be made, an example being the class not fully implementing the interface, null will be returned.
args
- Arguments for deserializationpublic static void registerClass(java.lang.Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable
class by its
aliasclazz
- Class to registerpublic static void registerClass(java.lang.Class<? extends ConfigurationSerializable> clazz, java.lang.String alias)
ConfigurationSerializable
classclazz
- Class to registeralias
- Alias to register asSerializableAs
public static void unregisterClass(java.lang.String alias)
ConfigurationSerializable
alias
- Alias to unregisterpublic static void unregisterClass(java.lang.Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable
classclazz
- Class to unregisterpublic static java.lang.Class<? extends ConfigurationSerializable> getClassByAlias(java.lang.String alias)
ConfigurationSerializable
class by
its aliasalias
- Alias of the serializablepublic static java.lang.String getAlias(java.lang.Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable
classclazz
- Class to get alias forCopyright © 2018. All rights reserved.