public final class ConversionTable
extends java.lang.Object
implements java.lang.Cloneable
| Constructor and Description |
|---|
ConversionTable()
Creates a new empty ConversionTable.
|
| Modifier and Type | Method and Description |
|---|---|
ConversionTable |
chainThen(ConversionTable after)
Returns a ConversionTable that behaves as if the specified table was applied just after
this table, for every conversion.
|
ConversionTable |
clone() |
boolean |
contains(java.lang.Class<?> classToConvert)
Checks that a function is defined for the specified class.
|
java.lang.Object |
convert(java.lang.Object value)
Converts a value using the conversion function that corresponds to its type.
|
void |
convertDeep(Config config)
Performs a deep in-place conversion of a Config.
|
void |
convertShallow(Config config)
Performs a shallow in-place conversion of a Config.
|
<T> void |
put(java.lang.Class<T> classToConvert,
java.util.function.Function<? super T,java.lang.Object> conversionFunction)
Puts a conversion function to the table.
|
void |
remove(java.lang.Class<?> classToConvert)
Removes the function that is currently defined for the specified class, if any.
|
java.lang.String |
toString() |
UnmodifiableConfig |
wrap(UnmodifiableConfig config)
Returns an UnmodifiableConfig that converts "just-in-time" the values of the specified
UnmodifiableConfig.
|
CommentedConfig |
wrapRead(CommentedConfig config)
Returns an Config that converts "just-in-time" the values that are read from the specified
Config.
|
CommentedFileConfig |
wrapRead(CommentedFileConfig config)
Returns an Config that converts "just-in-time" the values that are read from the specified
Config.
|
Config |
wrapRead(Config config)
Returns an Config that converts "just-in-time" the values that are read from the specified
Config.
|
FileConfig |
wrapRead(FileConfig config)
Returns an Config that converts "just-in-time" the values that are read from the specified
Config.
|
CommentedConfig |
wrapWrite(CommentedConfig config,
java.util.function.Predicate<java.lang.Class<?>> supportValueTypePredicate)
Returns an Config that converts "just-in-time" the values that are put into the specified
Config.
|
CommentedFileConfig |
wrapWrite(CommentedFileConfig config,
java.util.function.Predicate<java.lang.Class<?>> supportValueTypePredicate)
Returns an Config that converts "just-in-time" the values that are put into the specified
Config.
|
Config |
wrapWrite(Config config,
java.util.function.Predicate<java.lang.Class<?>> supportValueTypePredicate)
Returns an Config that converts "just-in-time" the values that are put into the specified
Config.
|
FileConfig |
wrapWrite(FileConfig config,
java.util.function.Predicate<java.lang.Class<?>> supportValueTypePredicate)
Returns an Config that converts "just-in-time" the values that are put into the specified
Config.
|
public <T> void put(java.lang.Class<T> classToConvert,
java.util.function.Function<? super T,java.lang.Object> conversionFunction)
T - the type of the values that the function can convertclassToConvert - the class of the values that the function can convert, may be nullconversionFunction - the conversion functionpublic void remove(java.lang.Class<?> classToConvert)
classToConvert - the class of the values that the function we want to remove convertspublic boolean contains(java.lang.Class<?> classToConvert)
classToConvert - the class of the values that the function convertstrue if the table contains a function for the class, false otherwisepublic java.lang.Object convert(java.lang.Object value)
value - the value to convert, may be nullpublic void convertShallow(Config config)
config - the config to convertpublic void convertDeep(Config config)
config - the config to convertpublic ConversionTable chainThen(ConversionTable after)
after - the table to apply after this onepublic UnmodifiableConfig wrap(UnmodifiableConfig config)
config - the config to wrappublic Config wrapRead(Config config)
config - the config to wrappublic CommentedConfig wrapRead(CommentedConfig config)
config - the config to wrappublic FileConfig wrapRead(FileConfig config)
config - the config to wrappublic CommentedFileConfig wrapRead(CommentedFileConfig config)
config - the config to wrappublic Config wrapWrite(Config config, java.util.function.Predicate<java.lang.Class<?>> supportValueTypePredicate)
config - the config to wrapsupportValueTypePredicate - Predicate that checks if a given class is supported by the
returned configpublic CommentedConfig wrapWrite(CommentedConfig config, java.util.function.Predicate<java.lang.Class<?>> supportValueTypePredicate)
config - the config to wrapsupportValueTypePredicate - Predicate that checks if a given class is supported by the
returned configpublic FileConfig wrapWrite(FileConfig config, java.util.function.Predicate<java.lang.Class<?>> supportValueTypePredicate)
config - the config to wrapsupportValueTypePredicate - Predicate that checks if a given class is supported by the
returned configpublic CommentedFileConfig wrapWrite(CommentedFileConfig config, java.util.function.Predicate<java.lang.Class<?>> supportValueTypePredicate)
config - the config to wrapsupportValueTypePredicate - Predicate that checks if a given class is supported by the
returned configpublic ConversionTable clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object