public class NinjaPropertiesImpl extends Object implements NinjaProperties
CONF_FILE_LOCATION_BY_CONVENTION, NINJA_EXTERNAL_CONF, NINJA_EXTERNAL_RELOAD
Constructor and Description |
---|
NinjaPropertiesImpl(NinjaMode ninjaMode) |
NinjaPropertiesImpl(NinjaMode ninjaMode,
String externalConfigurationPath) |
Modifier and Type | Method and Description |
---|---|
void |
bindProperties(com.google.inject.Binder binder) |
String |
get(String key)
Get a String property or null if it is not there...
|
Properties |
getAllCurrentNinjaProperties() |
Boolean |
getBoolean(String key) |
Boolean |
getBooleanOrDie(String key)
The "die" method forces this key to be set.
|
Boolean |
getBooleanWithDefault(String key,
Boolean defaultValue)
Get a Boolean property or a default value when property cannot be found
in any configuration file.
|
String |
getContextPath()
Get the context path on which the application is running
That means:
- when running on root the context path is empty
- when running on context there is NEVER a trailing slash
We conform to the following rules:
Returns the portion of the request URI that indicates the context of the
request.
|
Integer |
getInteger(String key)
Get a property as Integer of null if not there / or property no integer
|
Integer |
getIntegerOrDie(String key)
The "die" method forces this key to be set.
|
Integer |
getIntegerWithDefault(String key,
Integer defaultValue)
Get a Integer property or a default value when property cannot be found
in any configuration file.
|
String |
getOrDie(String key)
The "die" method forces this key to be set.
|
String[] |
getStringArray(String key)
eg.
|
String |
getWithDefault(String key,
String defaultValue)
Get a String property or a default value when property cannot be found in
any configuration file.
|
boolean |
isDev()
Whether we are in dev mode
|
boolean |
isProd()
Whether we are in prod mode
|
boolean |
isTest()
Whether we are in test mode
|
void |
setContextPath(String contextPath) |
void |
setProperty(String key,
String value) |
public NinjaPropertiesImpl(NinjaMode ninjaMode)
public String get(String key)
NinjaProperties
get
in interface NinjaProperties
public String getOrDie(String key)
NinjaProperties
getOrDie
in interface NinjaProperties
public Integer getInteger(String key)
NinjaProperties
getInteger
in interface NinjaProperties
public Integer getIntegerOrDie(String key)
NinjaProperties
getIntegerOrDie
in interface NinjaProperties
public Boolean getBooleanOrDie(String key)
NinjaProperties
getBooleanOrDie
in interface NinjaProperties
public Boolean getBoolean(String key)
getBoolean
in interface NinjaProperties
public void bindProperties(com.google.inject.Binder binder)
public boolean isProd()
NinjaProperties
isProd
in interface NinjaProperties
public boolean isDev()
NinjaProperties
isDev
in interface NinjaProperties
public boolean isTest()
NinjaProperties
isTest
in interface NinjaProperties
public String getContextPath()
getContextPath
in interface NinjaProperties
public void setContextPath(String contextPath)
setContextPath
in interface NinjaProperties
public Properties getAllCurrentNinjaProperties()
getAllCurrentNinjaProperties
in interface NinjaProperties
public String[] getStringArray(String key)
NinjaProperties
getStringArray
in interface NinjaProperties
public String getWithDefault(String key, String defaultValue)
NinjaProperties
getWithDefault
in interface NinjaProperties
key
- the key used in the configuration file.defaultValue
- Default value returned, when value cannot be found in
configuration.public Integer getIntegerWithDefault(String key, Integer defaultValue)
NinjaProperties
getIntegerWithDefault
in interface NinjaProperties
key
- the key used in the configuration file.defaultValue
- Default value returned, when value cannot be found in
configuration.public Boolean getBooleanWithDefault(String key, Boolean defaultValue)
NinjaProperties
getBooleanWithDefault
in interface NinjaProperties
key
- the key used in the configuration file.defaultValue
- Default value returned, when value cannot be found in
configuration.Copyright © 2019 ninjaframework. All rights reserved.