Skip to content

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. [This is a mirror from GitLab, please interact with the repository there.]

License

Notifications You must be signed in to change notification settings

elypia/converters4deltaSpike

Converters4DeltaSpike

Matrix Discord Maven Central Docs Build Coverage Donate

About

DeltaSpike supports a limited number types for configuration by default, please see a list of supported types on the official documentation. Converters4DeltaSpike provides additional ConfigResolver.Converter implementations for various types in Java which are optimized and thoroughly tested. This is helpful for applications, frameworks, or libraries, with a lot of flexibility in configuration including the ability to use regular expression, dates, or enumerated types.

This will add converters for the following types and types derived (extends) from them:

The Gradle/Maven import strings can be found at the maven-central badge above!

Usage

There are no special conditions or usage guidelines for this project; you can just follow the regular documentation provided by the Apache DeltaSpike project.

Please see the documentation for more information.

Example

The most simple example 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 {

    /** Accepts: / */
    @ConfigProperty(name = "seperator", converter = CharacterConverter.class)
    Character getSeperator();

    /** Accepts: #FFF */
    @ConfigProperty(name = "color", converter = ColorConverter.class)
    Color getColor();

    /** Accepts: P2D */ 
    @ConfigProperty(name = "interval", converter = DurationConverter.class)
    Duration getInterval();

    /** Accepts: java.time.DayOfWeek#MONDAY */
    @ConfigProperty(name = "day", converter = EnumConverter.class)
    DayOfWeek getDay();
    
    /** Accepts: en-US */
    @ConfigProperty(name = "locale", converter = LocaleConverter.class)
    Locale getLocale();
    
    /** Accepts: \\s+ */
    @ConfigProperty(name = "delimiter", converter = PatternConverter.class)
    Pattern getDelimiter();
}

Open-Source

This project is open-source under the Apache 2.0!
While not legal advice, you can find a TL;DR that sums up what you're allowed and not allowed to do along with any requirements if you want to use or derive work from this source code!

About

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. [This is a mirror from GitLab, please interact with the repository there.]

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Languages