public class NinjaPropertiesImpl extends java.lang.Object implements NinjaProperties
CONF_FILE_LOCATION_BY_CONVENTION, NINJA_EXTERNAL_CONF, NINJA_EXTERNAL_RELOAD| Constructor and Description |
|---|
NinjaPropertiesImpl(NinjaMode ninjaMode) |
| Modifier and Type | Method and Description |
|---|---|
void |
bindProperties(com.google.inject.Binder binder) |
java.lang.String |
get(java.lang.String key)
Get a String property or null if it is not there...
|
java.util.Properties |
getAllCurrentNinjaProperties() |
java.lang.Boolean |
getBoolean(java.lang.String key) |
java.lang.Boolean |
getBooleanOrDie(java.lang.String key)
The "die" method forces this key to be set.
|
java.lang.Boolean |
getBooleanWithDefault(java.lang.String key,
java.lang.Boolean defaultValue)
Get a Boolean property or a default value when property cannot be found
in any configuration file.
|
java.lang.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.
|
java.lang.Integer |
getInteger(java.lang.String key)
Get a property as Integer of null if not there / or property no integer
|
java.lang.Integer |
getIntegerOrDie(java.lang.String key)
The "die" method forces this key to be set.
|
java.lang.Integer |
getIntegerWithDefault(java.lang.String key,
java.lang.Integer defaultValue)
Get a Integer property or a default value when property cannot be found
in any configuration file.
|
java.lang.String |
getOrDie(java.lang.String key)
The "die" method forces this key to be set.
|
java.lang.String[] |
getStringArray(java.lang.String key)
eg.
|
java.lang.String |
getWithDefault(java.lang.String key,
java.lang.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(java.lang.String contextPath) |
void |
setProperty(java.lang.String key,
java.lang.String value) |
public NinjaPropertiesImpl(NinjaMode ninjaMode)
public java.lang.String get(java.lang.String key)
NinjaPropertiesget in interface NinjaPropertiespublic java.lang.String getOrDie(java.lang.String key)
NinjaPropertiesgetOrDie in interface NinjaPropertiespublic java.lang.Integer getInteger(java.lang.String key)
NinjaPropertiesgetInteger in interface NinjaPropertiespublic java.lang.Integer getIntegerOrDie(java.lang.String key)
NinjaPropertiesgetIntegerOrDie in interface NinjaPropertiespublic java.lang.Boolean getBooleanOrDie(java.lang.String key)
NinjaPropertiesgetBooleanOrDie in interface NinjaPropertiespublic java.lang.Boolean getBoolean(java.lang.String key)
getBoolean in interface NinjaPropertiespublic void setProperty(java.lang.String key,
java.lang.String value)
public 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 java.lang.String getContextPath()
getContextPath in interface NinjaPropertiespublic void setContextPath(java.lang.String contextPath)
setContextPath in interface NinjaPropertiespublic java.util.Properties getAllCurrentNinjaProperties()
getAllCurrentNinjaProperties in interface NinjaPropertiespublic java.lang.String[] getStringArray(java.lang.String key)
NinjaPropertiesgetStringArray in interface NinjaPropertiespublic java.lang.String getWithDefault(java.lang.String key,
java.lang.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 java.lang.Integer getIntegerWithDefault(java.lang.String key,
java.lang.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 java.lang.Boolean getBooleanWithDefault(java.lang.String key,
java.lang.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 © 2014 ninjaframework. All Rights Reserved.