Class PlatformConverter
java.lang.Object
net.tnemc.item.platform.conversion.PlatformConverter
PlatformConverter is used for converting TNIL-based data strings to the Platform's enum/registry entries.
- Since:
- 0.2.0.0
- Author:
- creatorfromhell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<I,O> O Performs a conversion from input type to output type using registered converters.<I,O> void registerConversion(Class<I> inputClass, Class<O> outputClass, Function<I, O> converter) Registers a conversion between input and output classes using a provided converter function.
-
Constructor Details
-
PlatformConverter
public PlatformConverter()
-
-
Method Details
-
registerConversion
public <I,O> void registerConversion(Class<I> inputClass, Class<O> outputClass, Function<I, O> converter) Registers a conversion between input and output classes using a provided converter function.- Type Parameters:
I- The input class typeO- The output class type- Parameters:
inputClass- The class of the input object to convert fromoutputClass- The class of the output object to convert toconverter- The function that performs the conversion from input to output- Since:
- 0.2.0.0, 0.2.0.0
-
convert
Performs a conversion from input type to output type using registered converters.- Type Parameters:
I- The type of the input objectO- The class of the output object- Parameters:
input- The input object to be convertedoutputClass- The class of the output type to be converted to- Returns:
- The converted output object
- Throws:
IllegalArgumentException- if the input is null or if no conversion is registered for the specified types- Since:
- 0.2.0.0, 0.2.0.0
-