public final class JRPropertiesUtil
extends java.lang.Object
The following actions are performed:
Modifier and Type | Class and Description |
---|---|
static class |
JRPropertiesUtil.PropertySuffix
Class used by
getProperties(String) . |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXCEPTION_MESSAGE_KEY_LOAD_PROPERTIES_FAILURE |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_LOAD_PROPERTIES_FILE_FAILURE |
static java.lang.String |
PROPERTY_PREFIX
The prefix used by all properties.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
asBoolean(java.lang.String value)
Converts a
String value into a boolean . |
static boolean |
asBoolean(java.lang.String value,
boolean defaultValue) |
static java.lang.Character |
asCharacter(java.lang.String value)
Converts a
String into a Character value. |
static float |
asFloat(java.lang.String value)
Converts a
String value into a float . |
static int |
asInteger(java.lang.String value)
Converts a
String value into a int . |
static long |
asLong(java.lang.String value)
Converts a
String value into a long . |
java.util.List<JRPropertiesUtil.PropertySuffix> |
getAllProperties(JRPropertiesHolder propertiesHolder,
java.lang.String prefix)
Returns the list of all properties for a key prefix, including global
properties.
|
java.util.List<JRPropertiesUtil.PropertySuffix> |
getAllProperties(JRPropertiesMap propertiesMap,
java.lang.String prefix)
Returns the list of all properties for a key prefix, including global
properties.
|
boolean |
getBooleanProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key,
boolean defaultValue)
Returns the value of a property as a boolean, looking first in the supplied properties holder
and then in the system properties.
|
java.lang.Boolean |
getBooleanProperty(JRPropertiesMap propertiesMap,
java.lang.String key)
Returns the value of a property as a boolean, looking first in the supplied properties map
and then in the system properties.
|
boolean |
getBooleanProperty(JRPropertiesMap propertiesMap,
java.lang.String key,
boolean defaultValue)
Returns the value of a property as a boolean, looking first in the supplied properties map
and then in the system properties.
|
boolean |
getBooleanProperty(java.lang.String key)
Returns a property as a boolean value.
|
boolean |
getBooleanProperty(java.lang.String key,
boolean defaultValue)
Returns a property as a boolean value.
|
boolean |
getBooleanProperty(java.lang.String key,
boolean defaultValue,
JRPropertiesHolder... propertiesHolders)
Returns the value of a property as a boolean, looking first in several properties holders
and then in the system properties.
|
java.lang.Character |
getCharacterProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key)
Returns the value of a property as a
Character value,
looking first in the supplied properties holder and then in the
system properties. |
java.lang.Character |
getCharacterProperty(JRPropertiesMap propertiesMap,
java.lang.String key)
Returns the value of a property as a
Character value,
looking first in the supplied properties map
and then in the system properties. |
java.lang.Character |
getCharacterProperty(java.lang.String key)
Returns a property as a
Character value. |
java.lang.Float |
getFloatProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key)
Returns the value of a property as a Float, looking first in the supplied properties holder
and then in the system properties.
|
float |
getFloatProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key,
float defaultValue)
Returns the value of a property as a float, looking first in the supplied properties holder
and then in the system properties.
|
float |
getFloatProperty(JRPropertiesMap propertiesMap,
java.lang.String key,
float defaultValue)
Returns the value of a property as a float, looking first in the supplied properties map
and then in the system properties.
|
float |
getFloatProperty(java.lang.String key)
Returns a property as a float value.
|
float |
getFloatProperty(java.lang.String key,
float defaultValue)
Returns the value of a property as a float.
|
static JRPropertiesUtil |
getInstance(JasperReportsContext jasperReportsContext) |
java.lang.Integer |
getIntegerProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key)
Returns the value of a property as an Integer, looking first in the supplied properties holder
and then in the system properties.
|
int |
getIntegerProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key,
int defaultValue)
Returns the value of a property as an integer, looking first in the supplied properties holder
and then in the system properties.
|
int |
getIntegerProperty(JRPropertiesMap propertiesMap,
java.lang.String key,
int defaultValue)
Returns the value of a property as an integer, looking first in the supplied properties map
and then in the system properties.
|
int |
getIntegerProperty(java.lang.String key)
Returns a property as an integer value.
|
int |
getIntegerProperty(java.lang.String key,
int defaultValue)
Returns the value of a property as an integer.
|
java.lang.String |
getLocalizedProperty(java.lang.String property,
java.util.Locale locale) |
long |
getLongProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key,
int defaultValue)
Deprecated.
Replaced by
getLongProperty(JRPropertiesHolder, String, long) . |
long |
getLongProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key,
long defaultValue)
Returns the value of a property as a long, looking first in the supplied properties holder
and then in the system properties.
|
long |
getLongProperty(JRPropertiesMap propertiesMap,
java.lang.String key,
int defaultValue)
Deprecated.
Replaced by
getLongProperty(JRPropertiesMap, String, long) . |
long |
getLongProperty(JRPropertiesMap propertiesMap,
java.lang.String key,
long defaultValue)
Returns the value of a property as a long, looking first in the supplied properties map
and then in the system properties.
|
long |
getLongProperty(java.lang.String key)
Returns a property as a long value.
|
protected static JRPropertiesMap |
getOwnProperties(JRPropertiesHolder propertiesHolder) |
static java.lang.String |
getOwnProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key) |
static java.util.List<JRPropertiesUtil.PropertySuffix> |
getProperties(JRPropertiesHolder propertiesHolder,
java.lang.String prefix)
Returns the list of all properties for a key prefix.
|
static java.util.List<JRPropertiesUtil.PropertySuffix> |
getProperties(JRPropertiesMap propertiesMap,
java.lang.String prefix)
Returns the list of all properties for a key prefix.
|
java.util.List<JRPropertiesUtil.PropertySuffix> |
getProperties(java.lang.String prefix)
Returns the list of all properties for a key prefix.
|
java.lang.String |
getProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key)
Returns the value of a property, looking first in the supplied properties holder
and then in the system properties.
|
java.lang.String |
getProperty(JRPropertiesMap propertiesMap,
java.lang.String key)
Returns the value of a property, looking first in the supplied properties map
and then in the system properties.
|
java.lang.String |
getProperty(java.lang.String key)
Returns the value of the property.
|
java.lang.String |
getProperty(java.lang.String key,
JRPropertiesHolder... propertiesHolders)
Returns the value of a property, looking for it in several properties holders
and then in the system properties.
|
static java.util.Properties |
loadProperties(java.lang.String name,
java.util.Properties defaults)
Loads a properties file from the classpath.
|
void |
removeProperty(java.lang.String key) |
void |
setProperty(java.lang.String key,
java.lang.String value) |
protected void |
transfer(JRPropertiesMap source,
JRPropertiesHolder destination,
java.lang.String tranferPropertiesPrefix) |
void |
transferProperties(JRPropertiesHolder source,
JRPropertiesHolder destination,
java.lang.String tranferPropertiesPrefix)
Copies properties from one object to another.
|
void |
transferProperties(JRPropertiesMap source,
JRPropertiesHolder destination,
java.util.List<java.lang.String> propertyNames) |
void |
transferProperties(JRPropertiesMap source,
JRPropertiesHolder destination,
java.lang.String tranferPropertiesPrefix)
Copies properties from one object to another.
|
public static final java.lang.String PROPERTY_PREFIX
public static final java.lang.String EXCEPTION_MESSAGE_KEY_LOAD_PROPERTIES_FILE_FAILURE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_LOAD_PROPERTIES_FAILURE
public static JRPropertiesUtil getInstance(JasperReportsContext jasperReportsContext)
public static java.util.Properties loadProperties(java.lang.String name, java.util.Properties defaults) throws JRException
name
- the resource namedefaults
- the default propertiesnull
otherwiseJRException
public java.lang.String getProperty(java.lang.String key)
key
- the keypublic void setProperty(java.lang.String key, java.lang.String value)
public void removeProperty(java.lang.String key)
public boolean getBooleanProperty(java.lang.String key)
key
- the keypublic boolean getBooleanProperty(java.lang.String key, boolean defaultValue)
key
- the keydefaultValue
- the default valuepublic int getIntegerProperty(java.lang.String key)
key
- the keypublic float getFloatProperty(java.lang.String key)
key
- the keypublic static boolean asBoolean(java.lang.String value)
String
value into a boolean
.value
- the valueboolean
public static boolean asBoolean(java.lang.String value, boolean defaultValue)
public static int asInteger(java.lang.String value)
String
value into a int
.value
- the valueint
public static float asFloat(java.lang.String value)
String
value into a float
.value
- the valuefloat
public java.util.List<JRPropertiesUtil.PropertySuffix> getProperties(java.lang.String prefix)
prefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuepublic static java.util.List<JRPropertiesUtil.PropertySuffix> getProperties(JRPropertiesHolder propertiesHolder, java.lang.String prefix)
propertiesHolder
- the properties holderprefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuegetAllProperties(JRPropertiesHolder, String)
public java.util.List<JRPropertiesUtil.PropertySuffix> getAllProperties(JRPropertiesHolder propertiesHolder, java.lang.String prefix)
propertiesHolder
- the properties holderprefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuegetProperties(JRPropertiesHolder, String)
public static java.util.List<JRPropertiesUtil.PropertySuffix> getProperties(JRPropertiesMap propertiesMap, java.lang.String prefix)
propertiesMap
are considered, and
not global properties.propertiesMap
- the properties mapprefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuegetAllProperties(JRPropertiesMap, String)
public java.util.List<JRPropertiesUtil.PropertySuffix> getAllProperties(JRPropertiesMap propertiesMap, java.lang.String prefix)
propertiesMap
- the properties mapprefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuegetProperties(JRPropertiesMap, String)
public java.lang.String getProperty(JRPropertiesHolder propertiesHolder, java.lang.String key)
propertiesHolder
- the properties holderkey
- the keypublic java.lang.String getProperty(java.lang.String key, JRPropertiesHolder... propertiesHolders)
key
- the keypropertiesHolders
- the properties holderspublic java.lang.String getProperty(JRPropertiesMap propertiesMap, java.lang.String key)
propertiesMap
- the properties mapkey
- the keypublic boolean getBooleanProperty(JRPropertiesHolder propertiesHolder, java.lang.String key, boolean defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not foundpublic boolean getBooleanProperty(java.lang.String key, boolean defaultValue, JRPropertiesHolder... propertiesHolders)
key
- the keydefaultValue
- the default value used if the property is not foundpropertiesHolders
- the properties holderspublic boolean getBooleanProperty(JRPropertiesMap propertiesMap, java.lang.String key, boolean defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not foundpublic java.lang.Boolean getBooleanProperty(JRPropertiesMap propertiesMap, java.lang.String key)
propertiesMap
- the properties mapkey
- the keypublic java.lang.Integer getIntegerProperty(JRPropertiesHolder propertiesHolder, java.lang.String key)
propertiesHolder
- the properties holderkey
- the keypublic int getIntegerProperty(JRPropertiesHolder propertiesHolder, java.lang.String key, int defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not foundpublic int getIntegerProperty(JRPropertiesMap propertiesMap, java.lang.String key, int defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not foundpublic int getIntegerProperty(java.lang.String key, int defaultValue)
key
- the keydefaultValue
- the default value used if the property is not foundpublic java.lang.Float getFloatProperty(JRPropertiesHolder propertiesHolder, java.lang.String key)
propertiesHolder
- the properties holderkey
- the keypublic float getFloatProperty(JRPropertiesHolder propertiesHolder, java.lang.String key, float defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not foundpublic float getFloatProperty(JRPropertiesMap propertiesMap, java.lang.String key, float defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not foundpublic float getFloatProperty(java.lang.String key, float defaultValue)
key
- the keydefaultValue
- the default value used if the property is not foundpublic static long asLong(java.lang.String value)
String
value into a long
.value
- the valuelong
public long getLongProperty(java.lang.String key)
key
- the keypublic long getLongProperty(JRPropertiesMap propertiesMap, java.lang.String key, int defaultValue)
getLongProperty(JRPropertiesMap, String, long)
.public long getLongProperty(JRPropertiesHolder propertiesHolder, java.lang.String key, int defaultValue)
getLongProperty(JRPropertiesHolder, String, long)
.public long getLongProperty(JRPropertiesMap propertiesMap, java.lang.String key, long defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not foundpublic long getLongProperty(JRPropertiesHolder propertiesHolder, java.lang.String key, long defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not foundprotected static JRPropertiesMap getOwnProperties(JRPropertiesHolder propertiesHolder)
public void transferProperties(JRPropertiesHolder source, JRPropertiesHolder destination, java.lang.String tranferPropertiesPrefix)
The properties to be copied are determined by one or more JasperReports properties having a specified prefix. The values of these properties are interpreted as prefixes of properties to copy.
source
- the source properties holderdestination
- the destination properties holdertranferPropertiesPrefix
- the prefix of the JasperReports properties
that specify the object properties to copypublic void transferProperties(JRPropertiesMap source, JRPropertiesHolder destination, java.lang.String tranferPropertiesPrefix)
source
- the source propertiesdestination
- the destination properties holdertranferPropertiesPrefix
- the prefix of the JasperReports properties
that specify the object properties to copytransferProperties(JRPropertiesHolder, JRPropertiesHolder, String)
public void transferProperties(JRPropertiesMap source, JRPropertiesHolder destination, java.util.List<java.lang.String> propertyNames)
protected void transfer(JRPropertiesMap source, JRPropertiesHolder destination, java.lang.String tranferPropertiesPrefix)
public java.lang.Character getCharacterProperty(java.lang.String key)
Character
value.key
- the keyCharacter
asCharacter(String)
public java.lang.Character getCharacterProperty(JRPropertiesHolder propertiesHolder, java.lang.String key)
Character
value,
looking first in the supplied properties holder and then in the
system properties.propertiesHolder
- the properties holderkey
- the keyCharacter
public java.lang.Character getCharacterProperty(JRPropertiesMap propertiesMap, java.lang.String key)
Character
value,
looking first in the supplied properties map
and then in the system properties.propertiesMap
- the properties mapkey
- the keyCharacter
public static java.lang.Character asCharacter(java.lang.String value)
String
into a Character
value.
If the String
value is null or the empty string,
null
is returned. Otherwise, the method returns
the first character in the string.
value
- the String
valueCharacter
public static java.lang.String getOwnProperty(JRPropertiesHolder propertiesHolder, java.lang.String key)
public java.lang.String getLocalizedProperty(java.lang.String property, java.util.Locale locale)
© 2001-2014 TIBCO Software Inc. www.jaspersoft.com