GithubHelp home page GithubHelp logo

tomzhang / owner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matteobaccan/owner

0.0 2.0 0.0 7.13 MB

Get rid of the boilerplate code in properties based configuration.

Home Page: http://owner.aeonbits.org

License: BSD 3-Clause "New" or "Revised" License

Java 87.60% HTML 4.63% Shell 0.11% CSS 7.66%

owner's Introduction

OWNER

OWNER, an API to ease Java property files usage.

Build Status Build Status Coverage Status

Built with Maven Powered by Sonar

INTRODUCTION

The goal of OWNER API is to minimize the code required to handle application configuration through Java properties files.

Full documentation available on project website.

BASIC USAGE

The approach used by OWNER APIs, is to define a Java interface associated to a properties file.

Suppose your properties file is defined as ServerConfig.properties:

port=80
hostname=foobar.com
maxThreads=100

To access this property you need to define a convenient Java interface in ServerConfig.java:

public interface ServerConfig extends Config {
    int port();
    String hostname();
    int maxThreads();
}

We'll call this interface the Properties Mapping Interface or just Mapping Interface since its goal is to map Properties into a an easy to use piece of code.

Then, you can use it from inside your code:

public class MyApp {
    public static void main(String[] args) {
        ServerConfig cfg = ConfigFactory.create(ServerConfig.class);
        System.out.println("Server " + cfg.hostname() + ":" + cfg.port() +
                           " will run " + cfg.maxThreads());
    }
}

But this is just the tip of the iceberg.

Continue reading here: Basic usage.

DOWNLOAD

Public Releases can be downloaded from GitHub Releases page or Maven Central Repository.

DOCUMENTATION

Make sure to have a look at the documentation on project website to learn how flexible and powerful OWNER is, and why you may need it!

LICENSE

OWNER is released under the BSD license. See LICENSE file included for the details.

owner's People

Contributors

lviggiano avatar robinmeiss avatar kevin-canadian avatar drapostolos avatar andreipet avatar svetanesterenko avatar nixxed avatar arturdryomov avatar ksaritek avatar

Watchers

mingfeng.zhang avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.