Provides configuration property converters for the DeltaSpike Configuration mechanism. Adds support for additional objects in the Java standard library, optimized and thoroughly tested for general use.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-04-21 20:03:16 +01:00
config/checkstyle chore: add checkstyle 2025-04-21 19:51:35 +01:00
gradle/wrapper chore: update gradle 2025-04-21 19:50:02 +01:00
src refactor: apply checkstyle and raise version to java 17 2025-04-21 19:52:36 +01:00
.editorconfig chore: add editorconfig 2025-04-20 07:58:32 +01:00
.gitignore chore: update gitignore 2025-04-21 19:50:01 +01:00
.gitlab-ci.yml refactor: apply checkstyle and raise version to java 17 2025-04-21 19:52:36 +01:00
build.gradle refactor: apply checkstyle and raise version to java 17 2025-04-21 19:52:36 +01:00
gradlew chore: update gradle 2025-04-21 19:50:02 +01:00
gradlew.bat chore: update gradle 2025-04-21 19:50:02 +01:00
LICENSE Initial Commit 2020-08-03 16:23:36 +02:00
NOTICE refactor: apply checkstyle and raise version to java 17 2025-04-21 19:52:36 +01:00
README.md docs: minor rewording of readme 2025-04-21 20:03:16 +01:00
settings.gradle Initial Commit 2020-08-03 16:23:36 +02:00

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:

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();
}