Class StringConverter<T>
java.lang.Object
me.hsgamer.hscore.config.annotation.converter.impl.StringConverter<T>
- Type Parameters:
T
- the type of the object
- All Implemented Interfaces:
Converter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConvert the raw value from the config file to the final value for the fieldprotected abstract T
convertFrom
(String string) Convert the string to the objectprotected abstract String
Convert the object to the stringconvertToRaw
(Object value) Convert the final value from the field to the raw value for the config filestatic <T> StringConverter<T>
Create a new instance of the converter
-
Constructor Details
-
StringConverter
public StringConverter()
-
-
Method Details
-
of
Create a new instance of the converter- Type Parameters:
T
- the type of the object- Parameters:
from
- the function to convert the string to the objectto
- the function to convert the object to the string- Returns:
- the new instance of the converter
-
convertFrom
Convert the string to the object- Parameters:
string
- the string- Returns:
- the object
-
convertTo
Convert the object to the string- Parameters:
t
- the object- Returns:
- the string
-
convert
Description copied from interface:Converter
Convert the raw value from the config file to the final value for the field -
convertToRaw
Description copied from interface:Converter
Convert the final value from the field to the raw value for the config file- Specified by:
convertToRaw
in interfaceConverter
- Parameters:
value
- the final value- Returns:
- the raw value
-