public final class ConfigTypes extends Object
| Modifier and Type | Field and Description |
|---|---|
static BooleanConfigType<Boolean> |
BOOLEAN
A
BooleanConfigType representing a bare boolean. |
static NumberConfigType<Byte> |
BYTE |
static StringConfigType<Character> |
CHARACTER
A
StringConfigType representing a character. |
static NumberConfigType<Double> |
DOUBLE |
static NumberConfigType<Float> |
FLOAT |
static NumberConfigType<Integer> |
INTEGER |
static NumberConfigType<Long> |
LONG |
static NumberConfigType<Integer> |
NATURAL |
static NumberConfigType<Short> |
SHORT |
static StringConfigType<String> |
STRING
A
StringConfigType representing a bare string with no constraints. |
static NumberConfigType<BigDecimal> |
UNBOUNDED_DECIMAL |
static NumberConfigType<BigInteger> |
UNBOUNDED_INTEGER |
| Constructor and Description |
|---|
ConfigTypes() |
| Modifier and Type | Method and Description |
|---|---|
static <S,E> ListConfigType<E[],S> |
makeArray(ConfigType<E,S,?> elementType)
Creates a
ListConfigType representing an array of reference type. |
static <S> ListConfigType<boolean[],S> |
makeBooleanArray(ConfigType<Boolean,S,?> elementType)
Creates a
ListConfigType representing an array of primitive type boolean. |
static <S> ListConfigType<byte[],S> |
makeByteArray(ConfigType<Byte,S,?> elementType)
Creates a
ListConfigType representing an array of primitive type byte. |
static <S> ListConfigType<char[],S> |
makeCharArray(ConfigType<Character,S,?> elementType)
Creates a
ListConfigType representing an array of primitive type char. |
static <S> ListConfigType<double[],S> |
makeDoubleArray(ConfigType<Double,S,?> elementType)
Creates a
ListConfigType representing an array of primitive type double. |
static <E extends Enum<E>> |
makeEnum(Class<E> enumType)
Creates an
EnumConfigType representing a value of enumType. |
static <S> ListConfigType<float[],S> |
makeFloatArray(ConfigType<Float,S,?> elementType)
Creates a
ListConfigType representing an array of primitive type float. |
static <S> ListConfigType<int[],S> |
makeIntArray(ConfigType<Integer,S,?> elementType)
Creates a
ListConfigType representing an array of primitive type int. |
static <E,S> ListConfigType<List<E>,S> |
makeList(ConfigType<E,S,?> elementType)
Creates a
ListConfigType representing a list of elementType. |
static <S> ListConfigType<long[],S> |
makeLongArray(ConfigType<Long,S,?> elementType)
Creates a
ListConfigType representing an array of primitive type long. |
static <K,V,S> MapConfigType<Map<K,V>,S> |
makeMap(StringConfigType<K> keyType,
ConfigType<V,S,?> valueType)
|
static <N> NumberConfigType<N> |
makeNumber(Class<N> numberType,
Function<N,BigDecimal> serializer,
Function<BigDecimal,N> deserializer,
N minValue,
N maxValue,
N precision)
Creates a
NumberConfigType representing a value of numberType. |
static <E,S> ListConfigType<Set<E>,S> |
makeSet(ConfigType<E,S,?> elementType)
Creates a
ListConfigType representing a set of elementType. |
static <S> ListConfigType<short[],S> |
makeShortArray(ConfigType<Short,S,?> elementType)
Creates a
ListConfigType representing an array of primitive type short. |
public static final BooleanConfigType<Boolean> BOOLEAN
BooleanConfigType representing a bare boolean.public static final NumberConfigType<BigDecimal> UNBOUNDED_DECIMAL
public static final NumberConfigType<BigInteger> UNBOUNDED_INTEGER
public static final NumberConfigType<Byte> BYTE
public static final NumberConfigType<Short> SHORT
public static final NumberConfigType<Integer> INTEGER
public static final NumberConfigType<Long> LONG
public static final NumberConfigType<Float> FLOAT
public static final NumberConfigType<Double> DOUBLE
public static final NumberConfigType<Integer> NATURAL
public static final StringConfigType<String> STRING
StringConfigType representing a bare string with no constraints.StringConfigType.withPattern(Pattern)public static final StringConfigType<Character> CHARACTER
StringConfigType representing a character.
This StringConfigType converts values between String
and Character by selecting the first char value in the serialized string.
Its SerializableType will only accept string values which length is exactly 1.
public static <N> NumberConfigType<N> makeNumber(Class<N> numberType, Function<N,BigDecimal> serializer, Function<BigDecimal,N> deserializer, @Nullable N minValue, @Nullable N maxValue, @Nullable N precision)
NumberConfigType representing a value of numberType.
The returned NumberConfigType converts values between BigDecimal
and N using the given conversion functions.
Its serialized type will only accept numerical values
that are within the given range, if any (null min/max/precision result in no bound).
N - The number type.numberType - The class object representing the actual number type.NumberConfigType holding a N.NullPointerException - if minValue is null but precision is not,
or if one of numberType, serializer or deserializer is null.public static <E extends Enum<E>> EnumConfigType<E> makeEnum(Class<E> enumType)
EnumConfigType representing a value of enumType.
The returned EnumConfigType converts values between String
and E using Enum.valueOf(Class, String).
Its serialized type will only accept string values
that correspond to the name of one of the enum constants.
E - The enum type.enumType - The class object of the enum type to represent.EnumConfigType holding a value of E.public static <E,S> ListConfigType<List<E>,S> makeList(ConfigType<E,S,?> elementType)
ListConfigType representing a list of elementType.
The returned ListConfigType converts values between List<S>
and List<E> by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.E - The set element type.elementType - The config type of the set elements.ListConfigType holding a Set<E>.public static <E,S> ListConfigType<Set<E>,S> makeSet(ConfigType<E,S,?> elementType)
ListConfigType representing a set of elementType.
The returned ListConfigType converts values between List<S>
and Set<E> by converting individually each element using the given elementType.
Its serialized type will only accept lists with
no duplicates (according to Object.equals(Object)) and where every element is accepted
by elementType.
S - The backing serialized type.E - The set element type.elementType - The config type of the set elements.ListConfigType holding a Set<E>.public static <S> ListConfigType<boolean[],S> makeBooleanArray(ConfigType<Boolean,S,?> elementType)
ListConfigType representing an array of primitive type boolean. If elementType
represents the type Boolean, then the element values are unboxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and boolean[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.elementType - The config type of the array components.ListConfigType holding a boolean[].public static <S> ListConfigType<byte[],S> makeByteArray(ConfigType<Byte,S,?> elementType)
ListConfigType representing an array of primitive type byte. If elementType
represents the type Byte, then the element values are unboxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and byte[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.elementType - The config type of the array components.ListConfigType holding a byte[].public static <S> ListConfigType<short[],S> makeShortArray(ConfigType<Short,S,?> elementType)
ListConfigType representing an array of primitive type short. If elementType
represents the type Short, then the element values are unboxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and short[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.elementType - The config type of the array components.ListConfigType holding a short[].public static <S> ListConfigType<int[],S> makeIntArray(ConfigType<Integer,S,?> elementType)
ListConfigType representing an array of primitive type int. If elementType
represents the type Integer, then the element values are unboxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and int[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.elementType - The config type of the array components.ListConfigType holding an int[].public static <S> ListConfigType<long[],S> makeLongArray(ConfigType<Long,S,?> elementType)
ListConfigType representing an array of primitive type long. If elementType
represents the type Long, then the element values are unboxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and long[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.elementType - The config type of the array components.ListConfigType holding a long[].public static <S> ListConfigType<float[],S> makeFloatArray(ConfigType<Float,S,?> elementType)
ListConfigType representing an array of primitive type float. If elementType
represents the type Float, then the element values are unboxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and float[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.elementType - The config type of the array components.ListConfigType holding a float[].public static <S> ListConfigType<double[],S> makeDoubleArray(ConfigType<Double,S,?> elementType)
ListConfigType representing an array of primitive type double. If elementType
represents the type Double, then the element values are unboxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and double[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.elementType - The config type of the array components.ListConfigType holding a double[].public static <S> ListConfigType<char[],S> makeCharArray(ConfigType<Character,S,?> elementType)
ListConfigType representing an array of primitive type char. If elementType
represents the type Character, then the element values are unboxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and char[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.elementType - The config type of the array components.ListConfigType holding a char[].public static <S,E> ListConfigType<E[],S> makeArray(ConfigType<E,S,?> elementType)
ListConfigType representing an array of reference type. If elementType represents
a primitive type, then the element values are boxed before being stored in the array.
The returned ListConfigType converts values between List<S>
and E[] by converting individually each element using the given elementType.
Its serialized type will only accept lists
where every element is accepted by elementType.
S - The backing serialized type.E - The (possibly boxed) array component type.elementType - The config type of the array components.ListConfigType holding an E[].public static <K,V,S> MapConfigType<Map<K,V>,S> makeMap(StringConfigType<K> keyType, ConfigType<V,S,?> valueType)
MapConfigType representing a map of keyType to valueType.
The returned MapConfigType converts values between Map<String, S>
and Map<K, V> by converting individually each element using their respective ConfigType.
Its serialized type will have no size constraint.
S - The backing serialized value type.K - The map key type.V - The map value type.keyType - The config type of the map's keys (must be convertible to String).valueType - The config type of the map's values.MapConfigType holding a Map<K, V>.