|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.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 String |
PROPERTY_PREFIX
The prefix used by all properties. |
| Method Summary | |
|---|---|
static boolean |
asBoolean(String value)
Converts a String value into a boolean. |
static boolean |
asBoolean(String value,
boolean defaultValue)
|
static Character |
asCharacter(String value)
Converts a String into a Character value. |
static float |
asFloat(String value)
Converts a String value into a float. |
static int |
asInteger(String value)
Converts a String value into a int. |
static long |
asLong(String value)
Converts a String value into a long. |
List<JRPropertiesUtil.PropertySuffix> |
getAllProperties(JRPropertiesHolder propertiesHolder,
String prefix)
Returns the list of all properties for a key prefix, including global properties. |
List<JRPropertiesUtil.PropertySuffix> |
getAllProperties(JRPropertiesMap propertiesMap,
String prefix)
Returns the list of all properties for a key prefix, including global properties. |
boolean |
getBooleanProperty(JRPropertiesHolder propertiesHolder,
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,
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(String key)
Returns a property as a boolean value. |
Character |
getCharacterProperty(JRPropertiesMap propertiesMap,
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. |
Character |
getCharacterProperty(String key)
Returns a property as a Character value. |
float |
getFloatProperty(JRPropertiesHolder propertiesHolder,
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,
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(String key)
Returns a property as a float value. |
float |
getFloatProperty(String key,
float defaultValue)
Returns the value of a property as a float. |
static JRPropertiesUtil |
getInstance(JasperReportsContext jasperReportsContext)
|
int |
getIntegerProperty(JRPropertiesHolder propertiesHolder,
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,
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(String key)
Returns a property as an integer value. |
int |
getIntegerProperty(String key,
int defaultValue)
Returns the value of a property as an integer. |
long |
getLongProperty(JRPropertiesHolder propertiesHolder,
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,
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(String key)
Returns a property as a long value. |
protected static JRPropertiesMap |
getOwnProperties(JRPropertiesHolder propertiesHolder)
|
static String |
getOwnProperty(JRPropertiesHolder propertiesHolder,
String key)
|
static List<JRPropertiesUtil.PropertySuffix> |
getProperties(JRPropertiesHolder propertiesHolder,
String prefix)
Returns the list of all properties for a key prefix. |
static List<JRPropertiesUtil.PropertySuffix> |
getProperties(JRPropertiesMap propertiesMap,
String prefix)
Returns the list of all properties for a key prefix. |
List<JRPropertiesUtil.PropertySuffix> |
getProperties(String prefix)
Returns the list of all properties for a key prefix. |
String |
getProperty(JRPropertiesHolder propertiesHolder,
String key)
Returns the value of a property, looking first in the supplied properties holder and then in the system properties. |
String |
getProperty(JRPropertiesMap propertiesMap,
String key)
Returns the value of a property, looking first in the supplied properties map and then in the system properties. |
String |
getProperty(String key)
Returns the value of the property. |
String |
getProperty(String key,
JRPropertiesHolder... propertiesHolders)
Returns the value of a property, looking for it in several properties holders and then in the system properties. |
static Properties |
loadProperties(String name,
Properties defaults)
Loads a properties file from the classpath. |
void |
removeProperty(String key)
|
void |
setProperty(String key,
String value)
|
protected void |
transfer(JRPropertiesMap source,
JRPropertiesHolder destination,
String tranferPropertiesPrefix)
|
void |
transferProperties(JRPropertiesHolder source,
JRPropertiesHolder destination,
String tranferPropertiesPrefix)
Copies properties from one object to another. |
void |
transferProperties(JRPropertiesMap source,
JRPropertiesHolder destination,
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 String PROPERTY_PREFIX
| Method Detail |
|---|
public static JRPropertiesUtil getInstance(JasperReportsContext jasperReportsContext)
public static Properties loadProperties(String name,
Properties defaults)
throws JRException
name - the resource namedefaults - the default properties
null otherwise
JRExceptionpublic String getProperty(String key)
key - the key
public void setProperty(String key,
String value)
public void removeProperty(String key)
public boolean getBooleanProperty(String key)
key - the key
public int getIntegerProperty(String key)
key - the key
public float getFloatProperty(String key)
key - the key
public static boolean asBoolean(String value)
String value into a boolean.
value - the value
boolean
public static boolean asBoolean(String value,
boolean defaultValue)
public static int asInteger(String value)
String value into a int.
value - the value
intpublic static float asFloat(String value)
String value into a float.
value - the value
floatpublic List<JRPropertiesUtil.PropertySuffix> getProperties(String prefix)
prefix - the key prefix
PropertySuffix objects containing the suffix of the key and the value
public static List<JRPropertiesUtil.PropertySuffix> getProperties(JRPropertiesHolder propertiesHolder,
String prefix)
propertiesHolder - the properties holderprefix - the key prefix
PropertySuffix objects containing the suffix of the key and the valuegetAllProperties(JRPropertiesHolder, String)
public List<JRPropertiesUtil.PropertySuffix> getAllProperties(JRPropertiesHolder propertiesHolder,
String prefix)
propertiesHolder - the properties holderprefix - the key prefix
PropertySuffix objects containing the suffix of the key and the valuegetProperties(JRPropertiesHolder, String)
public static List<JRPropertiesUtil.PropertySuffix> getProperties(JRPropertiesMap propertiesMap,
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 List<JRPropertiesUtil.PropertySuffix> getAllProperties(JRPropertiesMap propertiesMap,
String prefix)
propertiesMap - the properties mapprefix - the key prefix
PropertySuffix objects containing the suffix of the key and the valuegetProperties(JRPropertiesMap, String)
public String getProperty(JRPropertiesHolder propertiesHolder,
String key)
propertiesHolder - the properties holderkey - the key
public String getProperty(String key,
JRPropertiesHolder... propertiesHolders)
key - the keypropertiesHolders - the properties holders
public String getProperty(JRPropertiesMap propertiesMap,
String key)
propertiesMap - the properties mapkey - the key
public boolean getBooleanProperty(JRPropertiesHolder propertiesHolder,
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,
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,
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,
String key,
int defaultValue)
propertiesMap - the properties mapkey - the keydefaultValue - the default value used if the property is not found
public int getIntegerProperty(String key,
int defaultValue)
key - the keydefaultValue - the default value used if the property is not found
public float getFloatProperty(JRPropertiesHolder propertiesHolder,
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,
String key,
float defaultValue)
propertiesMap - the properties mapkey - the keydefaultValue - the default value used if the property is not found
public float getFloatProperty(String key,
float defaultValue)
key - the keydefaultValue - the default value used if the property is not found
public static long asLong(String value)
String value into a long.
value - the value
longpublic long getLongProperty(String key)
key - the key
public long getLongProperty(JRPropertiesMap propertiesMap,
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,
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,
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 copy
public void transferProperties(JRPropertiesMap source,
JRPropertiesHolder destination,
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,
String tranferPropertiesPrefix)
public Character getCharacterProperty(String key)
Character value.
key - the key
CharacterasCharacter(String)
public Character getCharacterProperty(JRPropertiesMap propertiesMap,
String key)
Character value,
looking first in the supplied properties holder and then in the
system properties.
propertiesMap - the properties mapkey - the key
Characterpublic static Character asCharacter(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 String getOwnProperty(JRPropertiesHolder propertiesHolder,
String key)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||