程序包 org.bukkit.configuration.serialization

# 类 ConfigurationSerialization

java.lang.Object
org.bukkit.configuration.serialization.ConfigurationSerialization

public class ConfigurationSerialization extends Object
Utility class for storing and retrieving classes for `Configuration`.

- ## 字段概要

  字段
  修饰符和类型
  字段
  说明
  `static final String`
  `SERIALIZED_TYPE_KEY`

- ## 构造器概要

  构造器
  限定符
  构造器
  说明
  `protected`
  `ConfigurationSerialization(@NotNull Class<? extends ConfigurationSerializable> clazz)`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `@Nullable ConfigurationSerializable`
  `deserialize(@NotNull Map<String,?> args)`
  `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`
  `deserializeViaCtor(@NotNull Constructor<? extends ConfigurationSerializable> ctor, @NotNull Map<String,?> args)`
  `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()`
  `protected @Nullable Method`
  `getMethod(@NotNull String name, boolean isStatic)`
  `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`

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 字段详细资料

  - ### SERIALIZED_TYPE_KEY

    public static final String SERIALIZED_TYPE_KEY
    另请参阅:
      - 常量字段值

- ## 构造器详细资料

  - ### ConfigurationSerialization

    protected ConfigurationSerialization(@NotNull @NotNull Class<? extends ConfigurationSerializable> clazz)

- ## 方法详细资料

  - ### getMethod

    @Nullable protected @Nullable Method getMethod(@NotNull @NotNull String name, boolean isStatic)

  - ### getConstructor

    @Nullable protected @Nullable Constructor<? extends ConfigurationSerializable> getConstructor()

  - ### deserializeViaMethod

    @Nullable protected @Nullable ConfigurationSerializable deserializeViaMethod(@NotNull @NotNull Method method, @NotNull @NotNull Map<String,?> args)

  - ### deserializeViaCtor

    @Nullable protected @Nullable ConfigurationSerializable deserializeViaCtor(@NotNull @NotNull Constructor<? extends ConfigurationSerializable> ctor, @NotNull @NotNull Map<String,?> args)

  - ### deserialize

    @Nullable public @Nullable ConfigurationSerializable deserialize(@NotNull @NotNull Map<String,?> args)

  - ### deserializeObject

    @Nullable public static @Nullable ConfigurationSerializable deserializeObject(@NotNull @NotNull Map<String,?> args, @NotNull @NotNull Class<? extends ConfigurationSerializable> clazz)
    Attempts to deserialize the given arguments into a new instance of the given class.

    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 deserialization
      `clazz` - Class to deserialize into
    返回:
      New instance of the specified class

  - ### deserializeObject

    @Nullable public static @Nullable ConfigurationSerializable deserializeObject(@NotNull @NotNull Map<String,?> args)
    Attempts to deserialize the given arguments into a new instance of the given class.

    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 deserialization
    返回:
      New instance of the specified class

  - ### registerClass

    public static void registerClass(@NotNull @NotNull Class<? extends ConfigurationSerializable> clazz)
    Registers the given `ConfigurationSerializable` class by its alias
    参数:
      `clazz` - Class to register

  - ### registerClass

    public static void registerClass(@NotNull @NotNull Class<? extends ConfigurationSerializable> clazz, @NotNull @NotNull String alias)
    Registers the given alias to the specified `ConfigurationSerializable` class
    参数:
      `clazz` - Class to register
      `alias` - Alias to register as
    另请参阅:
      - `SerializableAs`

  - ### unregisterClass

    public static void unregisterClass(@NotNull @NotNull String alias)
    Unregisters the specified alias to a `ConfigurationSerializable`
    参数:
      `alias` - Alias to unregister

  - ### unregisterClass

    public static void unregisterClass(@NotNull @NotNull Class<? extends ConfigurationSerializable> clazz)
    Unregisters any aliases for the specified `ConfigurationSerializable` class
    参数:
      `clazz` - Class to unregister

  - ### getClassByAlias

    @Nullable public static @Nullable Class<? extends ConfigurationSerializable> getClassByAlias(@NotNull @NotNull String alias)
    Attempts to get a registered `ConfigurationSerializable` class by its alias
    参数:
      `alias` - Alias of the serializable
    返回:
      Registered class, or null if not found

  - ### getAlias

    @NotNull public static @NotNull String getAlias(@NotNull @NotNull Class<? extends ConfigurationSerializable> clazz)
    Gets the correct alias for the given `ConfigurationSerializable` class
    参数:
      `clazz` - Class to get alias for
    返回:
      Alias to use for the class