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:
Character
Color
Dimension
Duration
Enum
File
InetAddress
Instant
Locale
Pattern
Period
Point
URI
URL
UUID
The Gradle/Maven import strings can be found at the maven-central badge above!
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.
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();
}
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!