Package org.aeonbits.owner
package org.aeonbits.owner
The goal of OWNER API is to minimize the code required to handle application configuration through Java properties files.
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=100To access this property you need to define a convenient Java interface in ServerConfig.java:
public interface ServerConfig extends Config {
int port();
String hostname();
@DefaultValue("42");
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.
Owner has a lot of features and its behavior is fully customizable to your needs.
Have a look at the full documentation from the OWNER website.
-
ClassDescriptionAllows a
Configobject to access the contents of the properties, providing utility methods to perform consequent operations.Marker interface that must be implemented by all Config sub-interfaces.Specifies aclass to convert the property value into theConverterCollectionreturned by the method, in a single step.Specifies aclass to allow the user to define a custom conversion logic for the type returned by the method.ConverterShows, throughAccessibleandObject.toString(), only the properties this interface declares.The defaultDecryptorfor everyConfig.EncryptedValueof this interface that does not name one of its own, so that a whole configuration can share a decryptor.Default value to be used if no property is found.What this property is for, in a sentence, written where the property is declared.This enum contains the features that can be disabled using the annotationConfig.DisableFeature.Specifies to disable some of the features supported by the API.Declares that this method's value is encrypted, and is to be decrypted by theDecryptornamed here or, when none is, by the one the interface declares withConfig.DecryptorClass.Specify that the class implements hot reloading of properties from filesystem bakedConfig.Sources(hot reloading can't be applied to all types of URIs).Allows to specify which type of HotReload should be applied.The key used for lookup for the property.Specifies the policy for loading the properties files.Specifies the policy type to use to load theConfig.Sourcesfiles for properties.Marks a property as mandatory.Specifies a prefix that is prepended to the keys of all the properties declared in the annotated interface.Specifies aclass to allow the user to define a custom logic to pre-process the property value before being used by the library.PreprocessorMarks a property as sensitive, so that its value is replaced byConfig.Sensitive.MASKin the output meant to be read by a human:Accessible.list(java.io.PrintStream),Accessible.list(java.io.PrintWriter)andtoString().Specifies simpleas separator to tokenize properties values specified as a single string value, into elements for vectors and collections.StringSpecifies the source from which to load the properties file.Specifies aclass to allow the user to define a custom logic to split the property value into tokens to be used as single elements for vectors and collections.TokenizerUtility class caching Config instances that can be used as Singletons.A static factory class to instantiateConfiginstances.Converter<T>Converter interface specifies how to convert an input string coming from a property value to a target object returned by the Config method.Interface for factory implementation used to instantiateConfiginstances.Thrown when a property marked asConfig.Mandatorycannot be resolved: at creation time, listing all the missing keys, or at access time when the property has become unavailable.Allows aConfigobject to change its property values at runtime.Where a property came from: which of thesourcesproduced it, or whether it was an import, aConfig.DefaultValueor something written at run time.What kind of place a property came from.Preprocessor interface specifies how to pre-process an input string coming from a property value before being used by OWNER.Allows aConfigobject to implement the reloading of the properties at runtime.Writes the properties file of a mapping interface, from the command line, without running the application it belongs to.Tokenizer interface that specifies how to split a single value into tokens to be used as elements for arrays and collections.Allows aConfigobject to say where each of its properties came from.