conf4j

conf4j is a library that simplify configuration access via object to configuration mapping

License

License

GroupId

GroupId

com.sabre.oss.conf4j
ArtifactId

ArtifactId

conf4j
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

pom
Description

Description

conf4j
conf4j is a library that simplify configuration access via object to configuration mapping
Project URL

Project URL

https://github.com/SabreOSS/conf4j
Project Organization

Project Organization

Sabre GLBL Inc.
Source Code Management

Source Code Management

http://github.com/SabreOSS/conf4j/tree/master

Download conf4j

Filename Size
conf4j-1.0.pom 22 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.sabre.oss.conf4j/conf4j/ -->
<dependency>
    <groupId>com.sabre.oss.conf4j</groupId>
    <artifactId>conf4j</artifactId>
    <version>1.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.sabre.oss.conf4j/conf4j/
implementation 'com.sabre.oss.conf4j:conf4j:1.0'
// https://jarcasting.com/artifacts/com.sabre.oss.conf4j/conf4j/
implementation ("com.sabre.oss.conf4j:conf4j:1.0")
'com.sabre.oss.conf4j:conf4j:pom:1.0'
<dependency org="com.sabre.oss.conf4j" name="conf4j" rev="1.0">
  <artifact name="conf4j" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.sabre.oss.conf4j', module='conf4j', version='1.0')
)
libraryDependencies += "com.sabre.oss.conf4j" % "conf4j" % "1.0"
[com.sabre.oss.conf4j/conf4j "1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • conf4j-api
  • conf4j-core
  • conf4j-javassist
  • conf4j-spring
  • conf4j-spring-boot
  • conf4j-extras
  • conf4j-ck
  • conf4j-performance
  • conf4j-examples

Conf4j - Type-safe Configuration Library for Java

Build Status Maven Central

conf4j is a library which allows accessing configuration data in object-oriented, type-safe manner.

In conf4j configuration is represented as an interface or abstract class optionally annotated with conf4j annotations.

@Key("connection")
public interface ConnectionConfiguration {
   String getUrl();

   String getUser();

   String getPassword();

   @Default("60")
   int getConnectionTimeout();

   @Default("30")
   int getReadTimeout();
}

Then a configuration instance is created and bound to the value source by the configuration factory.

ConfigurationSource source = new PropertiesConfigurationSource("configuration.properties");
ConfigurationFactory factory = new JdkProxyStaticConfigurationFactory();
ConnectionConfiguration configuration = factory.createConfiguration(ConnectionConfiguration.class, source);

Once the configuration instance is created you can access the configuration values via getters:

String url =  configuration.getUrl();
int connectionTimeout = configuration.getConnectionTimeout();

Example configuration.properties is as follows:

connection.url=https://github.com/SabreOss/conf4j
connection.user=john
connection.password=secret
connection.connectionTimeout=45

For more information how to use conf4j please read Conf4j User's Guide and check conf4j-examples directory.

Contributing

We accept pull request via GitHub. Here are some guidelines which will make applying PRs easier for us:

  • No tabs. Please use spaces for indentation.
  • Respect the code style.
  • Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
  • Provide JUnit tests for your changes and make sure they don't break anything by running mvn clean verify.

See CONTRIBUTING document for more details.

License

Copyright 2017-2018 Sabre GLBL Inc.

Code is under the MIT license.

com.sabre.oss.conf4j

Sabre

Travel Inspired, Tech Obsessed

Versions

Version
1.0
1.0.RC2
1.0.RC1
0.9
0.9.RC1