public final class Config
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static AConfig |
Defaults
Initializes specified class with default values if any.
|
| Modifier and Type | Method and Description |
|---|---|
static AConfig |
anyOf(AConfig... sources) |
static <T> T |
get(java.lang.Class<T> clazz)
Loads settings for specified interface.
|
static AConfig |
use(java.lang.Class<?> clazz)
Builds a config reader from .properties file which location is specified by annotations in the given class.
|
static AConfig |
use(java.io.File file)
Builds a config reader from .properties file specified by File object.
|
static AConfig |
use(java.lang.String resourceName)
Builds a config reader from .properties file located in class path resources.
|
static AConfig |
use(java.net.URL url)
Builds a config reader from .properties file specified by url.
|
static AConfig |
useEnv() |
static AConfig |
useJvm() |
public static final AConfig Defaults
public static AConfig use(java.io.File file)
file - .properties file.public static AConfig use(java.net.URL url)
url - url to .properties file.public static AConfig use(java.lang.String resourceName)
resourceName - resource name.public static AConfig useEnv()
public static AConfig useJvm()
public static AConfig use(java.lang.Class<?> clazz) throws SettingsException
clazz - class annotated with @SettingsSource annotation.SettingsException - if interface methods are not annotated or interface is not annotated with
@SettingsSourcepublic static <T> T get(java.lang.Class<T> clazz)
throws SettingsException
If specified class marked with Optional annotation a null value will be
returned in case when required resource is not exists.
T - target interface for holding settings.clazz - target interface class for holding settings.SettingsException - if interface methods are not annotated or interface is not annotated with
@SettingsSource