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<T> type)
Get the implicit converter for the given type class, if any.
|
static <T extends Comparable<T>> |
maximumValueConverter(org.eclipse.microprofile.config.spi.Converter<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>> |
minimumValueConverter(org.eclipse.microprofile.config.spi.Converter<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 <A,T> org.eclipse.microprofile.config.spi.Converter<A> |
newArrayConverter(org.eclipse.microprofile.config.spi.Converter<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<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> |
patternValidatingConverter(org.eclipse.microprofile.config.spi.Converter<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<T> delegate,
String pattern)
Get a wrapping converter which verifies that the configuration value matches the given pattern.
|
static <T extends Comparable<T>> |
rangeValueConverter(org.eclipse.microprofile.config.spi.Converter<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.
|
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<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<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<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 extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> minimumValueConverter(org.eclipse.microprofile.config.spi.Converter<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 extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> maximumValueConverter(org.eclipse.microprofile.config.spi.Converter<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 extends Comparable<T>> org.eclipse.microprofile.config.spi.Converter<T> rangeValueConverter(org.eclipse.microprofile.config.spi.Converter<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> patternValidatingConverter(org.eclipse.microprofile.config.spi.Converter<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<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.