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)
NinjaPropertiesget in interface NinjaPropertiespublic String getOrDie(String key)
NinjaPropertiesgetOrDie in interface NinjaPropertiespublic Integer getInteger(String key)
NinjaPropertiesgetInteger in interface NinjaPropertiespublic Integer getIntegerOrDie(String key)
NinjaPropertiesgetIntegerOrDie in interface NinjaPropertiespublic Boolean getBooleanOrDie(String key)
NinjaPropertiesgetBooleanOrDie in interface NinjaPropertiespublic Boolean getBoolean(String key)
getBoolean in interface NinjaPropertiespublic void bindProperties(com.google.inject.Binder binder)
public boolean isProd()
NinjaPropertiesisProd in interface NinjaPropertiespublic boolean isDev()
NinjaPropertiesisDev in interface NinjaPropertiespublic boolean isTest()
NinjaPropertiesisTest in interface NinjaPropertiespublic String getContextPath()
getContextPath in interface NinjaPropertiespublic void setContextPath(String contextPath)
setContextPath in interface NinjaPropertiespublic Properties getAllCurrentNinjaProperties()
getAllCurrentNinjaProperties in interface NinjaPropertiespublic String[] getStringArray(String key)
NinjaPropertiesgetStringArray in interface NinjaPropertiespublic String getWithDefault(String key, String defaultValue)
NinjaPropertiesgetWithDefault in interface NinjaPropertieskey - 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)
NinjaPropertiesgetIntegerWithDefault in interface NinjaPropertieskey - 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)
NinjaPropertiesgetBooleanWithDefault in interface NinjaPropertieskey - the key used in the configuration file.defaultValue - Default value returned, when value cannot be found in
configuration.Copyright © 2019 ninjaframework. All rights reserved.