Module gomint.api

Class SetConverter

  • All Implemented Interfaces:
    Converter

    public class SetConverter
    extends Object
    implements Converter
    Version:
    1.0
    Author:
    geNAZt
    • Constructor Detail

    • Method Detail

      • toConfig

        public Object toConfig​(Class<?> type,
                               Object object,
                               ParameterizedType parameterizedType)
                        throws Exception
        This method gets called on save. It gets the Fields Type and the object the Config wants to save into it. This is needed to pretty print INTO the config.
        Specified by:
        toConfig in interface Converter
        Parameters:
        type - The type (Class) of the Field
        object - The object which is stored in the Config Object
        parameterizedType - If the Class has some generic information this is the information otherwise this is null
        Returns:
        An Object (mostly a Map or a List)
        Throws:
        Exception - Some generic exception when something went wrong. This gets caught by the converter
      • fromConfig

        public Object fromConfig​(Class type,
                                 Object object,
                                 ParameterizedType parameterizedType)
                          throws Exception
        This method gets called when we want to load something out of the File. You get that what you give into the Config via toConfig as Object passed. The type is the Destination Field Type which this Object should be layed in.
        Specified by:
        fromConfig in interface Converter
        Parameters:
        type - The type (Class) of the Field
        object - The Object from toConfig
        parameterizedType - If the Class has some generic information this is the information otherwise this is null
        Returns:
        The correct Object which can be hold by the Field
        Throws:
        Exception - Some generic exception when something went wrong. This gets caught by the converter
      • supports

        public boolean supports​(Class<?> type)
        This checks if this converter can convert the given Class
        Specified by:
        supports in interface Converter
        Parameters:
        type - The type (Class) of the Field to check
        Returns:
        true if this can convert that otherwise false