public class Extension extends Settings implements Comparable<Extension>
Settings
framework.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT
Name of the default entry for an extension
|
protected String |
id |
protected static Log |
LOG |
protected int |
priority |
protected String |
type |
Modifier | Constructor and Description |
---|---|
protected |
Extension(String type,
String id,
com.typesafe.config.ConfigObject configObject,
com.typesafe.config.ConfigObject defaultConfig) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Extension o) |
boolean |
equals(Object o) |
Value |
get(String path)
Returns the
Value defined for the given key. |
com.typesafe.config.Config |
getConfig(String key)
Returns the sub config available for the given key.
|
Context |
getContext()
Returns all values defined in this extension as
Context . |
String |
getId()
Returns the unique ID of this extension
|
long |
getMilliseconds(String path)
Returns the duration in milliseconds defined for the given key.
|
String |
getQualifiedName()
Returns the complete "dot separated" name like {@code [extension.path].
|
Value |
getRaw(String path)
Returns the
Value defined for the given key. |
String |
getType()
Returns the type name of the extension
|
int |
hashCode() |
boolean |
isDefault()
Determined if this extension is an artifically created default extension.
|
Object |
make(String classProperty)
Creates a new instance of the class which is named in classProperty
Tries to lookup the value for classProperty, fetches the corresponding class and creates a new
instance for it.
|
Value |
require(String path)
Returns the
Value defined for the given key or throws a HandledException if no value was found
If this extension doesn't provide a value for this key, but there is an extension with the name
default which provides a value, this is used. |
getConfig, getConfigs, getInt, getMap, getString, getStringList, injectValueFromConfig
public static final String DEFAULT
protected static final Log LOG
protected final int priority
protected final String type
protected final String id
@Nonnull public Value getRaw(String path)
Value
defined for the given key.
In contrast to get(String)
this will not perform an automatic translation
if the value starts with a dollar sign.
path
- the access path to retrieve the valueValue.isNull()
@Nonnull public Value get(String path)
Settings
Value
defined for the given key.
If this extension doesn't provide a value for this key, but there is an extension with the name default which provides a value, this is used.
If the value in the config file starts with a dollar sign, the value is treated as an i18n key and the returned value will contain the translation for the current language.
get
in class Settings
path
- the access path to retrieve the valueValue.isNull()
@Nullable public com.typesafe.config.Config getConfig(String key)
Settings
@Nonnull public Context getContext()
Settings
Context
.getContext
in class Settings
public long getMilliseconds(String path)
Settings
If this extension doesn't provide a value for this key, but there is an extension with the name default which provides a value, this is used.
getMilliseconds
in class Settings
path
- the access path to retrieve the value@Nonnull public Value require(String path)
Value
defined for the given key or throws a HandledException if no value was found
If this extension doesn't provide a value for this key, but there is an extension with the name default which provides a value, this is used.
Returning a Value
instead of a plain object provides lots of conversion methods on the one hand
and also guarantees a non null result on the other hand, since a Value can be empty.
path
- the access path to retrieve the valueHandledException
- if no value was found for the given path@Nonnull public Object make(String classProperty)
Tries to lookup the value for classProperty, fetches the corresponding class and creates a new instance for it.
Returning a Value
instead of a plain object provides lots of conversion methods on the one hand
and also guarantees a non null result on the other hand, since a Value can be empty.
classProperty
- the property which is used to retrieve the class nameHandledException
- if no valid class was given, or if no instance could be createdpublic String getType()
public String getId()
public String getQualifiedName()
[extension.path].[id]
public boolean isDefault()
ExtendedSettings.getExtension(String, String)
if nothing was foundpublic int compareTo(@Nullable Extension o)
compareTo
in interface Comparable<Extension>
Copyright © 2018. All rights reserved.