public class ConfigurationSerialization extends Object
Configuration
.Modifier and Type | Field and Description |
---|---|
static String |
SERIALIZED_TYPE_KEY |
Modifier | Constructor and Description |
---|---|
protected |
ConfigurationSerialization(Class<? extends ConfigurationSerializable> clazz) |
Modifier and Type | Method and Description |
---|---|
ConfigurationSerializable |
deserialize(Map<String,?> args) |
static ConfigurationSerializable |
deserializeObject(Map<String,?> args)
Attempts to deserialize the given arguments into a new instance of the
given class.
|
static ConfigurationSerializable |
deserializeObject(Map<String,?> args,
Class<? extends ConfigurationSerializable> clazz)
Attempts to deserialize the given arguments into a new instance of the
given class.
|
protected ConfigurationSerializable |
deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor,
Map<String,?> args) |
protected ConfigurationSerializable |
deserializeViaMethod(Method method,
Map<String,?> args) |
static String |
getAlias(Class<? extends ConfigurationSerializable> clazz)
Gets the correct alias for the given
ConfigurationSerializable
class |
static Class<? extends ConfigurationSerializable> |
getClassByAlias(String alias)
Attempts to get a registered
ConfigurationSerializable class by
its alias |
protected Constructor<? extends ConfigurationSerializable> |
getConstructor() |
protected Method |
getMethod(String name,
boolean isStatic) |
static void |
registerClass(Class<? extends ConfigurationSerializable> clazz)
Registers the given
ConfigurationSerializable class by its
alias |
static void |
registerClass(Class<? extends ConfigurationSerializable> clazz,
String alias)
Registers the given alias to the specified
ConfigurationSerializable class |
static void |
unregisterClass(Class<? extends ConfigurationSerializable> clazz)
Unregisters any aliases for the specified
ConfigurationSerializable class |
static void |
unregisterClass(String alias)
Unregisters the specified alias to a
ConfigurationSerializable |
public static final String SERIALIZED_TYPE_KEY
protected ConfigurationSerialization(Class<? extends ConfigurationSerializable> clazz)
protected Constructor<? extends ConfigurationSerializable> getConstructor()
protected ConfigurationSerializable deserializeViaMethod(Method method, Map<String,?> args)
protected ConfigurationSerializable deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor, Map<String,?> args)
public ConfigurationSerializable deserialize(Map<String,?> args)
public static ConfigurationSerializable deserializeObject(Map<String,?> args, 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(Map<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(Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable
class by its
aliasclazz
- Class to registerpublic static void registerClass(Class<? extends ConfigurationSerializable> clazz, String alias)
ConfigurationSerializable
classclazz
- Class to registeralias
- Alias to register asSerializableAs
public static void unregisterClass(String alias)
ConfigurationSerializable
alias
- Alias to unregisterpublic static void unregisterClass(Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable
classclazz
- Class to unregisterpublic static Class<? extends ConfigurationSerializable> getClassByAlias(String alias)
ConfigurationSerializable
class by
its aliasalias
- Alias of the serializablepublic static String getAlias(Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable
classclazz
- Class to get alias forCopyright © 2016. All rights reserved.