public final class ConfigurationSerialization extends Object
Configuration.
Synchronized with the commit on 23-April-2019.| Modifier and Type | Field and Description |
|---|---|
static String |
SERIALIZED_TYPE_KEY |
| Modifier | Constructor and Description |
|---|---|
protected |
ConfigurationSerialization(@NotNull Class<? extends ConfigurationSerializable> clazz)
Constructs a new
ConfigurationSerialization for the given
ConfigurationSerializable. |
| Modifier and Type | Method and Description |
|---|---|
@Nullable ConfigurationSerializable |
deserialize(@NotNull Map<String,?> args)
Deserializes the given
Map into a
ConfigurationSerializable. |
static @Nullable ConfigurationSerializable |
deserializeObject(@NotNull Map<String,?> args)
Attempts to deserialize the given arguments into a new instance of the
given class.
|
static @Nullable ConfigurationSerializable |
deserializeObject(@NotNull Map<String,?> args,
@NotNull Class<? extends ConfigurationSerializable> clazz)
Attempts to deserialize the given arguments into a new instance of the
given class.
|
protected @Nullable ConfigurationSerializable |
deserializeViaConstructor(@NotNull Constructor<? extends ConfigurationSerializable> constructor,
@NotNull Map<String,?> args)
Deserializes the data in the
Map via the given
Constructor. |
protected @Nullable ConfigurationSerializable |
deserializeViaMethod(@NotNull Method method,
@NotNull Map<String,?> args)
|
static @NotNull String |
getAlias(@NotNull Class<? extends ConfigurationSerializable> clazz)
Gets the correct alias for the given
ConfigurationSerializable
class |
static @Nullable Class<? extends ConfigurationSerializable> |
getClassByAlias(@NotNull String alias)
Attempts to get a registered
ConfigurationSerializable class by
its alias |
protected @Nullable Constructor<? extends ConfigurationSerializable> |
getConstructor()
Gets the
Constructor of the ConfigurationSerializable
that performs the deserialization. |
protected @Nullable Method |
getMethod(@NotNull String name,
boolean isStatic)
Gets the
Method of the ConfigurationSerializable that
performs the deserialization. |
static void |
registerClass(@NotNull Class<? extends ConfigurationSerializable> clazz)
Registers the given
ConfigurationSerializable class by its
alias |
static void |
registerClass(@NotNull Class<? extends ConfigurationSerializable> clazz,
@NotNull String alias)
Registers the given alias to the specified
ConfigurationSerializable class |
static void |
unregisterClass(@NotNull Class<? extends ConfigurationSerializable> clazz)
Unregisters any aliases for the specified
ConfigurationSerializable class |
static void |
unregisterClass(@NotNull String alias)
Unregisters the specified alias to a
ConfigurationSerializable |
public static final String SERIALIZED_TYPE_KEY
protected ConfigurationSerialization(@NotNull
@NotNull Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerialization for the given
ConfigurationSerializable.clazz - The ConfigurationSerializable Class.@Nullable public @Nullable ConfigurationSerializable deserialize(@NotNull @NotNull Map<String,?> args)
Map into a
ConfigurationSerializable.args - The serialized data.Object, or null if the data
cannot be deserialized.@Nullable protected @Nullable Constructor<? extends ConfigurationSerializable> getConstructor()
Constructor of the ConfigurationSerializable
that performs the deserialization. If none can be found, null
is returned.Constructor that performs the deserialization, or
null if none can be found.@Nullable protected @Nullable Method getMethod(@NotNull @NotNull String name, boolean isStatic)
Method of the ConfigurationSerializable that
performs the deserialization. If none can be found, null is
returned.Method that performs the deserialization, or
null if none can be found.@Nullable protected @Nullable ConfigurationSerializable deserializeViaConstructor(@NotNull @NotNull Constructor<? extends ConfigurationSerializable> constructor, @NotNull @NotNull Map<String,?> args)
Map via the given
Constructor. If any Throwable is thrown,
null will be returned.constructor - The Constructor to use to deserialize the
data.args - The data to deserialize.ConfigurationSerializable, or
null if there is an issue.@Nullable protected @Nullable ConfigurationSerializable deserializeViaMethod(@NotNull @NotNull Method method, @NotNull @NotNull Map<String,?> args)
Map via the given Method. If
any Throwable is thrown, null will be returned.method - The Method to use to deserialize the data.args - The data to deserialize.ConfigurationSerializable, or
null if there is an issue.@Nullable public static @Nullable ConfigurationSerializable deserializeObject(@NotNull @NotNull Map<String,?> args, @NotNull @NotNull 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 into@Nullable public static @Nullable ConfigurationSerializable deserializeObject(@NotNull @NotNull 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(@NotNull
@NotNull Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable class by its
aliasclazz - Class to registerpublic static void registerClass(@NotNull
@NotNull Class<? extends ConfigurationSerializable> clazz,
@NotNull
@NotNull String alias)
ConfigurationSerializable classclazz - Class to registeralias - Alias to register asSerializableAspublic static void unregisterClass(@NotNull
@NotNull String alias)
ConfigurationSerializablealias - Alias to unregisterpublic static void unregisterClass(@NotNull
@NotNull Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable classclazz - Class to unregister@Nullable public static @Nullable Class<? extends ConfigurationSerializable> getClassByAlias(@NotNull @NotNull String alias)
ConfigurationSerializable class by
its aliasalias - Alias of the serializable@NotNull public static @NotNull String getAlias(@NotNull @NotNull Class<? extends ConfigurationSerializable> clazz)
ConfigurationSerializable
classclazz - Class to get alias forCopyright © 2021 BSPF Systems, LLC. All rights reserved.