- Java 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| config/checkstyle | ||
| gradle/wrapper | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| build.gradle | ||
| gradlew | ||
| gradlew.bat | ||
| LICENSE | ||
| NOTICE | ||
| README.md | ||
| settings.gradle | ||
Converters4DeltaSpike
Deprecation Notice
This project is no longer maintained, as I'm working on migrating all converters upstream into DeltaSpike.
About
DeltaSpike supports very few types for configuration out of the box, see a list on the DeltaSpike documentation. This library provides additional ConfigResolver.Converter implementations for standard Java types which are optimized and thoroughly tested.
This adds converters for the following types and types derived (extends) from them:
CharacterColorDimensionDurationEnumFileInetAddressInstantLocalePatternPeriodPointURIURLUUID
Getting Started
There are no special considerations for this library, follow the TypedResolverAPI documentation provided by the Apache DeltaSpike project.
Import
Visit Converters4DeltaSpike on Maven Central, and follow the instructions for your build system of choice to add Converters4DeltaSpike to your project.
Usage
The simplest usage is to create an interface-based configuration and use the @ConfigProperty#converter() property to specify the desired converter for the type required.
@Configuration(prefix = "config.")
public interface MyCustomConfig {
/** / */
@ConfigProperty(name = "separator", converter = CharacterConverter.class)
Character getSeparator();
/** #FFF */
@ConfigProperty(name = "color", converter = ColorConverter.class)
Color getColor();
/** P2D */
@ConfigProperty(name = "interval", converter = DurationConverter.class)
Duration getInterval();
/** java.time.DayOfWeek#MONDAY */
@ConfigProperty(name = "day", converter = EnumConverter.class)
DayOfWeek getDay();
/** en-US */
@ConfigProperty(name = "locale", converter = LocaleConverter.class)
Locale getLocale();
/** \\s+ */
@ConfigProperty(name = "delimiter", converter = PatternConverter.class)
Pattern getDelimiter();
}