|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jasperreports.engine.JRPropertiesUtil
public final class JRPropertiesUtil
Class that provides static methods for loading, getting and setting properties.
The following actions are performed:
Nested Class Summary | |
---|---|
static class |
JRPropertiesUtil.PropertySuffix
Class used by getProperties(String) . |
Field Summary | |
---|---|
static java.lang.String |
PROPERTY_PREFIX
The prefix used by all properties. |
Method Summary | |
---|---|
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. |
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. |
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 holder and then in the
system properties. |
java.lang.Character |
getCharacterProperty(java.lang.String key)
Returns a property as a Character value. |
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)
|
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. |
long |
getLongProperty(JRPropertiesHolder propertiesHolder,
java.lang.String key,
int 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)
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.lang.String tranferPropertiesPrefix)
Copies properties from one object to another. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PROPERTY_PREFIX
Method Detail |
---|
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 properties
null
otherwise
JRException
public java.lang.String getProperty(java.lang.String key)
key
- the key
public 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 key
public int getIntegerProperty(java.lang.String key)
key
- the key
public float getFloatProperty(java.lang.String key)
key
- the key
public static boolean asBoolean(java.lang.String value)
String
value into a boolean
.
value
- the value
boolean
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 value
int
public static float asFloat(java.lang.String value)
String
value into a float
.
value
- the value
float
public java.util.List<JRPropertiesUtil.PropertySuffix> getProperties(java.lang.String prefix)
prefix
- the key prefix
PropertySuffix
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 prefix
PropertySuffix
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 prefix
PropertySuffix
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 prefix
PropertySuffix
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 prefix
PropertySuffix
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 key
public java.lang.String getProperty(java.lang.String key, JRPropertiesHolder... propertiesHolders)
key
- the keypropertiesHolders
- the properties holders
public java.lang.String getProperty(JRPropertiesMap propertiesMap, java.lang.String key)
propertiesMap
- the properties mapkey
- the key
public 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 found
public 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 found
public 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 found
public 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 found
public int getIntegerProperty(java.lang.String key, int defaultValue)
key
- the keydefaultValue
- the default value used if the property is not found
public 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 found
public 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 found
public float getFloatProperty(java.lang.String key, float defaultValue)
key
- the keydefaultValue
- the default value used if the property is not found
public static long asLong(java.lang.String value)
String
value into a long
.
value
- the value
long
public long getLongProperty(java.lang.String key)
key
- the key
public long getLongProperty(JRPropertiesMap propertiesMap, java.lang.String key, int defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not found
public long getLongProperty(JRPropertiesHolder propertiesHolder, java.lang.String key, int defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not found
protected 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)
protected void transfer(JRPropertiesMap source, JRPropertiesHolder destination, java.lang.String tranferPropertiesPrefix)
public java.lang.Character getCharacterProperty(java.lang.String key)
Character
value.
key
- the key
Character
asCharacter(String)
public java.lang.Character getCharacterProperty(JRPropertiesMap propertiesMap, java.lang.String key)
Character
value,
looking first in the supplied properties holder and then in the
system properties.
propertiesMap
- the properties mapkey
- the key
Character
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
value
Character
public static java.lang.String getOwnProperty(JRPropertiesHolder propertiesHolder, java.lang.String key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |