public final class Converters extends Object
| Modifier and Type | Method and Description |
|---|---|
static Type |
getConverterType(Class<?> clazz)
Get the type of the converter specified by
clazz. |
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
getImplicitConverter(Class<? extends T> type)
Get the implicit converter for the given type class, if any.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
maximumValueConverter(Comparator<? super T> comparator,
org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
T maximumValue,
boolean inclusive)
Get a wrapping converter which verifies that the configuration value is less than, or optionally equal to,
the given maximum value.
|
static <T extends Comparable<T>> |
maximumValueConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
T maximumValue,
boolean inclusive)
Get a wrapping converter which verifies that the configuration value is less than, or optionally equal to,
the given maximum value.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
maximumValueStringConverter(Comparator<? super T> comparator,
org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
String maximumValue,
boolean inclusive)
Get a wrapping converter which verifies that the configuration value is less than, or optionally equal to,
the given maximum value (in string form).
|
static <T extends Comparable<T>> |
maximumValueStringConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
String maximumValue,
boolean inclusive)
Get a wrapping converter which verifies that the configuration value is less than, or optionally equal to,
the given maximum value (in string form).
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
minimumValueConverter(Comparator<? super T> comparator,
org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
T minimumValue,
boolean inclusive)
Get a wrapping converter which verifies that the configuration value is greater than, or optionally equal to,
the given minimum value.
|
static <T extends Comparable<T>> |
minimumValueConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
T minimumValue,
boolean inclusive)
Get a wrapping converter which verifies that the configuration value is greater than, or optionally equal to,
the given minimum value.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
minimumValueStringConverter(Comparator<? super T> comparator,
org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
String minimumValue,
boolean inclusive)
Get a wrapping converter which verifies that the configuration value is greater than, or optionally equal to,
the given minimum value (in string form).
|
static <T extends Comparable<T>> |
minimumValueStringConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
String minimumValue,
boolean inclusive)
Get a wrapping converter which verifies that the configuration value is greater than, or optionally equal to,
the given minimum value (in string form).
|
static <A,T> org.eclipse.microprofile.config.spi.Converter<A> |
newArrayConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> itemConverter,
Class<A> arrayType)
Get a converter that converts a comma-separated string into an array of converted items.
|
static <T,C extends Collection<T>> |
newCollectionConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> itemConverter,
IntFunction<C> collectionFactory)
Get a converter that converts a comma-separated string into a list of converted items.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
newEmptyValueConverter(org.eclipse.microprofile.config.spi.Converter<T> delegateConverter)
Get a converter which wraps another converter and handles empty values correctly.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
newEmptyValueConverter(org.eclipse.microprofile.config.spi.Converter<T> delegateConverter,
T emptyValue)
Get a converter which wraps another converter and returns a special value to represent empty.
|
static <T> org.eclipse.microprofile.config.spi.Converter<Optional<T>> |
newOptionalConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegateConverter)
Get a converter which wraps another converter's result into an
Optional. |
static org.eclipse.microprofile.config.spi.Converter<OptionalDouble> |
newOptionalDoubleConverter(org.eclipse.microprofile.config.spi.Converter<Double> delegateConverter)
Get a converter which wraps another converter's result into an
OptionalDouble. |
static org.eclipse.microprofile.config.spi.Converter<OptionalInt> |
newOptionalIntConverter(org.eclipse.microprofile.config.spi.Converter<Integer> delegateConverter)
Get a converter which wraps another converter's result into an
OptionalInt. |
static org.eclipse.microprofile.config.spi.Converter<OptionalLong> |
newOptionalLongConverter(org.eclipse.microprofile.config.spi.Converter<Long> delegateConverter)
Get a converter which wraps another converter's result into an
OptionalLong. |
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
newTrimmingConverter(org.eclipse.microprofile.config.spi.Converter<T> delegateConverter)
Get a converter which trims the string input before passing it on to the delegate converter.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
patternValidatingConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
Pattern pattern)
Get a wrapping converter which verifies that the configuration value matches the given pattern.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
patternValidatingConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
String pattern)
Get a wrapping converter which verifies that the configuration value matches the given pattern.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
rangeValueConverter(Comparator<? super T> comparator,
org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
T minimumValue,
boolean minInclusive,
T maximumValue,
boolean maxInclusive)
Get a wrapping converter which verifies that the configuration value is within the given range.
|
static <T extends Comparable<T>> |
rangeValueConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
T minimumValue,
boolean minInclusive,
T maximumValue,
boolean maxInclusive)
Get a wrapping converter which verifies that the configuration value is within the given range.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
rangeValueStringConverter(Comparator<? super T> comparator,
org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
String minimumValue,
boolean minInclusive,
String maximumValue,
boolean maxInclusive)
Get a wrapping converter which verifies that the configuration value is within the given range (in string form).
|
static <T extends Comparable<T>> |
rangeValueStringConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
String minimumValue,
boolean minInclusive,
String maximumValue,
boolean maxInclusive)
Get a wrapping converter which verifies that the configuration value is within the given range (in string form).
|
public static Type getConverterType(Class<?> clazz)
clazz. If the given class is not a valid
converter, then null is returned.clazz - the converter class (must not be null)null if the class does not represent a valid configurationIllegalStateException - if the given converter class is not properly parameterizedpublic static <T> org.eclipse.microprofile.config.spi.Converter<T> getImplicitConverter(Class<? extends T> type)
T - the typetype - the type classnull if none existspublic static <T,C extends Collection<T>> org.eclipse.microprofile.config.spi.Converter<C> newCollectionConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> itemConverter, IntFunction<C> collectionFactory)
T - the item typeC - the collection typeitemConverter - the item converter (must not be null)collectionFactory - the collection factory (must not be null)null)public static <A,T> org.eclipse.microprofile.config.spi.Converter<A> newArrayConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> itemConverter,
Class<A> arrayType)
T - the item typeA - the array typeitemConverter - the item converter (must not be null)arrayType - the array type class (must not be null)null)public static <T> org.eclipse.microprofile.config.spi.Converter<Optional<T>> newOptionalConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegateConverter)
Optional. If the delegate converter
returns null, this converter returns Optional.empty().T - the item typedelegateConverter - the delegate converter (must not be null)null)public static org.eclipse.microprofile.config.spi.Converter<OptionalInt> newOptionalIntConverter(org.eclipse.microprofile.config.spi.Converter<Integer> delegateConverter)
OptionalInt. If the delegate converter
returns null, this converter returns Optional.empty().delegateConverter - the delegate converter (must not be null)null)public static org.eclipse.microprofile.config.spi.Converter<OptionalLong> newOptionalLongConverter(org.eclipse.microprofile.config.spi.Converter<Long> delegateConverter)
OptionalLong. If the delegate converter
returns null, this converter returns Optional.empty().delegateConverter - the delegate converter (must not be null)null)public static org.eclipse.microprofile.config.spi.Converter<OptionalDouble> newOptionalDoubleConverter(org.eclipse.microprofile.config.spi.Converter<Double> delegateConverter)
OptionalDouble. If the delegate converter
returns null, this converter returns Optional.empty().delegateConverter - the delegate converter (must not be null)null)public static <T> org.eclipse.microprofile.config.spi.Converter<T> newEmptyValueConverter(org.eclipse.microprofile.config.spi.Converter<T> delegateConverter,
T emptyValue)
T - the value typedelegateConverter - the converter to delegate to (must not be null)emptyValue - the empty value to returnpublic static <T> org.eclipse.microprofile.config.spi.Converter<T> newEmptyValueConverter(org.eclipse.microprofile.config.spi.Converter<T> delegateConverter)
null or empty.T - the value typedelegateConverter - the converter to delegate to (must not be null)public static <T> org.eclipse.microprofile.config.spi.Converter<T> newTrimmingConverter(org.eclipse.microprofile.config.spi.Converter<T> delegateConverter)
T - the value typedelegateConverter - the converter to delegate to (must not be null)public static <T extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> minimumValueConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, T minimumValue, boolean inclusive)
T - the converter target typedelegate - the delegate converter (must not be null)minimumValue - the minimum value (must not be null)inclusive - true if the minimum value is inclusive, false otherwisepublic static <T> org.eclipse.microprofile.config.spi.Converter<T> minimumValueConverter(Comparator<? super T> comparator, org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, T minimumValue, boolean inclusive)
T - the converter target typecomparator - the comparator to use (must not be null)delegate - the delegate converter (must not be null)minimumValue - the minimum value (must not be null)inclusive - true if the minimum value is inclusive, false otherwisepublic static <T extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> minimumValueStringConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, String minimumValue, boolean inclusive)
T - the converter target typedelegate - the delegate converter (must not be null)minimumValue - the minimum value (must not be null)inclusive - true if the minimum value is inclusive, false otherwiseIllegalArgumentException - if the given minimum value fails conversionpublic static <T> org.eclipse.microprofile.config.spi.Converter<T> minimumValueStringConverter(Comparator<? super T> comparator, org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, String minimumValue, boolean inclusive)
T - the converter target typecomparator - the comparator to use (must not be null)delegate - the delegate converter (must not be null)minimumValue - the minimum value (must not be null)inclusive - true if the minimum value is inclusive, false otherwiseIllegalArgumentException - if the given minimum value fails conversionpublic static <T extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> maximumValueConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, T maximumValue, boolean inclusive)
T - the converter target typedelegate - the delegate converter (must not be null)maximumValue - the maximum value (must not be null)inclusive - true if the maximum value is inclusive, false otherwisepublic static <T> org.eclipse.microprofile.config.spi.Converter<T> maximumValueConverter(Comparator<? super T> comparator, org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, T maximumValue, boolean inclusive)
T - the converter target typecomparator - the comparator to use (must not be null)delegate - the delegate converter (must not be null)maximumValue - the maximum value (must not be null)inclusive - true if the maximum value is inclusive, false otherwisepublic static <T extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> maximumValueStringConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, String maximumValue, boolean inclusive)
T - the converter target typedelegate - the delegate converter (must not be null)maximumValue - the maximum value (must not be null)inclusive - true if the maximum value is inclusive, false otherwiseIllegalArgumentException - if the given maximum value fails conversionpublic static <T> org.eclipse.microprofile.config.spi.Converter<T> maximumValueStringConverter(Comparator<? super T> comparator, org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, String maximumValue, boolean inclusive)
T - the converter target typecomparator - the comparator to use (must not be null)delegate - the delegate converter (must not be null)maximumValue - the maximum value (must not be null)inclusive - true if the maximum value is inclusive, false otherwiseIllegalArgumentException - if the given maximum value fails conversionpublic static <T extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> rangeValueConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, T minimumValue, boolean minInclusive, T maximumValue, boolean maxInclusive)
T - the converter target typedelegate - the delegate converter (must not be null)maximumValue - the maximum value (must not be null)maxInclusive - true if the maximum value is inclusive, false otherwisepublic static <T> org.eclipse.microprofile.config.spi.Converter<T> rangeValueConverter(Comparator<? super T> comparator, org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, T minimumValue, boolean minInclusive, T maximumValue, boolean maxInclusive)
T - the converter target typecomparator - the comparator to use (must not be null)delegate - the delegate converter (must not be null)maximumValue - the maximum value (must not be null)maxInclusive - true if the maximum value is inclusive, false otherwisepublic static <T extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> rangeValueStringConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, String minimumValue, boolean minInclusive, String maximumValue, boolean maxInclusive)
T - the converter target typedelegate - the delegate converter (must not be null)maximumValue - the maximum value (must not be null)maxInclusive - true if the maximum value is inclusive, false otherwiseIllegalArgumentException - if the given minimum or maximum value fails conversionpublic static <T> org.eclipse.microprofile.config.spi.Converter<T> rangeValueStringConverter(Comparator<? super T> comparator, org.eclipse.microprofile.config.spi.Converter<? extends T> delegate, String minimumValue, boolean minInclusive, String maximumValue, boolean maxInclusive)
T - the converter target typecomparator - the comparator to use (must not be null)delegate - the delegate converter (must not be null)maximumValue - the maximum value (must not be null)maxInclusive - true if the maximum value is inclusive, false otherwiseIllegalArgumentException - if the given minimum or maximum value fails conversionpublic static <T> org.eclipse.microprofile.config.spi.Converter<T> patternValidatingConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
Pattern pattern)
T - the converter target typedelegate - the delegate converter (must not be null)pattern - the pattern to match (must not be null)public static <T> org.eclipse.microprofile.config.spi.Converter<T> patternValidatingConverter(org.eclipse.microprofile.config.spi.Converter<? extends T> delegate,
String pattern)
T - the converter target typedelegate - the delegate converter (must not be null)pattern - the pattern string to match (must not be null)PatternSyntaxException - if the given pattern has invalid syntaxCopyright © 2018–2019. All rights reserved.