Class ScalarConverter
java.lang.Object
com.ultikits.ultitools.config.convert.builtin.ScalarConverter
- All Implemented Interfaces:
ConfigConverter<Object>
Exact scalar conversions; numeric decisions never narrow through a double cast.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static BigDecimalprivate static ConversionExceptionfailure(ConversionContext ctx, String message) fromPlain(Object plain, ConversionContext ctx) Converts plain data to a Java value.private static booleantoPlain(Object value, ConversionContext ctx) Converts a Java value to plain data.
-
Field Details
-
target
-
-
Constructor Details
-
ScalarConverter
- Parameters:
target- the scalar target, primitive or wrapper
-
-
Method Details
-
toPlain
Description copied from interface:ConfigConverterConverts a Java value to plain data.- Specified by:
toPlainin interfaceConfigConverter<Object>- Parameters:
value- the Java valuectx- the immutable conversion location and recursive dispatcher- Returns:
- plain data
- Throws:
ConversionException- when conversion cannot preserve the value
-
fromPlain
Description copied from interface:ConfigConverterConverts plain data to a Java value.- Specified by:
fromPlainin interfaceConfigConverter<Object>- Parameters:
plain- the value read from the documentctx- the immutable conversion location and recursive dispatcher- Returns:
- the Java value
- Throws:
ConversionException- when the input cannot be converted
-
decimal
-
nonfinite
-
failure
-