Class ConfigurationSerialization


  • public class ConfigurationSerialization
    extends Object
    Utility class for storing and retrieving classes for Configuration.
    • Method Detail

      • getMethod

        @Nullable
        protected @Nullable Method getMethod​(@NotNull
                                             @NotNull String name,
                                             boolean isStatic)
      • 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.

        Parameters:
        args - Arguments for deserialization
        clazz - Class to deserialize into
        Returns:
        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.

        Parameters:
        args - Arguments for deserialization
        Returns:
        New instance of the specified class
      • unregisterClass

        public static void unregisterClass​(@NotNull
                                           @NotNull String alias)
        Unregisters the specified alias to a ConfigurationSerializable
        Parameters:
        alias - Alias 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
        Parameters:
        alias - Alias of the serializable
        Returns:
        Registered class, or null if not found