JRPropertiesUtil
.public final class JRProperties extends Object
The following actions are performed:
Modifier and Type | Class and Description |
---|---|
static class |
JRProperties.PropertySuffix
Deprecated.
Class used by
getProperties(String) . |
Modifier and Type | Method and Description |
---|---|
static boolean |
asBoolean(String value)
Deprecated.
Converts a
String value into a boolean . |
static Character |
asCharacter(String value)
Deprecated.
Converts a
String into a Character value. |
static float |
asFloat(String value)
Deprecated.
Converts a
String value into a float . |
static int |
asInteger(String value)
Deprecated.
Converts a
String value into a int . |
static long |
asLong(String value)
Deprecated.
Converts a
String value into a long . |
static void |
backupProperties()
Deprecated.
Saves a copy of the current properties.
|
static List<JRProperties.PropertySuffix> |
getAllProperties(JRPropertiesHolder propertiesHolder,
String prefix)
Deprecated.
Returns the list of all properties for a key prefix, including global
properties.
|
static List<JRProperties.PropertySuffix> |
getAllProperties(JRPropertiesMap propertiesMap,
String prefix)
Deprecated.
Returns the list of all properties for a key prefix, including global
properties.
|
static Boolean |
getBooleanProperty(JRPropertiesHolder propertiesHolder,
String key)
Deprecated.
Returns the value of a property as a Boolean object, looking first in the supplied properties holder
and then in the system properties.
|
static boolean |
getBooleanProperty(JRPropertiesHolder propertiesHolder,
String key,
boolean defaultValue)
Deprecated.
Returns the value of a property as a boolean, looking first in the supplied properties holder
and then in the system properties.
|
static boolean |
getBooleanProperty(JRPropertiesMap propertiesMap,
String key,
boolean defaultValue)
Deprecated.
Returns the value of a property as a boolean, looking first in the supplied properties map
and then in the system properties.
|
static boolean |
getBooleanProperty(String key)
Deprecated.
Returns a property as a boolean value.
|
static Character |
getCharacterProperty(JRPropertiesMap propertiesMap,
String key)
Deprecated.
Returns the value of a property as a
Character value,
looking first in the supplied properties holder and then in the
system properties. |
static Character |
getCharacterProperty(String key)
Deprecated.
Returns a property as a
Character value. |
protected static Properties |
getDefaults()
Deprecated.
Sets the default properties.
|
static float |
getFloatProperty(JRPropertiesHolder propertiesHolder,
String key,
float defaultValue)
Deprecated.
Returns the value of a property as a float, looking first in the supplied properties holder
and then in the system properties.
|
static float |
getFloatProperty(JRPropertiesMap propertiesMap,
String key,
float defaultValue)
Deprecated.
Returns the value of a property as a float, looking first in the supplied properties map
and then in the system properties.
|
static float |
getFloatProperty(String key)
Deprecated.
Returns a property as a float value.
|
static float |
getFloatProperty(String key,
float defaultValue)
Deprecated.
Returns the value of a property as a float.
|
static int |
getIntegerProperty(JRPropertiesHolder propertiesHolder,
String key,
int defaultValue)
Deprecated.
Returns the value of a property as an integer, looking first in the supplied properties holder
and then in the system properties.
|
static int |
getIntegerProperty(JRPropertiesMap propertiesMap,
String key,
int defaultValue)
Deprecated.
Returns the value of a property as an integer, looking first in the supplied properties map
and then in the system properties.
|
static int |
getIntegerProperty(String key)
Deprecated.
Returns a property as an integer value.
|
static int |
getIntegerProperty(String key,
int defaultValue)
Deprecated.
Returns the value of a property as an integer.
|
static long |
getLongProperty(JRPropertiesHolder propertiesHolder,
String key,
int defaultValue)
Deprecated.
Returns the value of a property as a long, looking first in the supplied properties holder
and then in the system properties.
|
static long |
getLongProperty(JRPropertiesMap propertiesMap,
String key,
int defaultValue)
Deprecated.
Returns the value of a property as a long, looking first in the supplied properties map
and then in the system properties.
|
static long |
getLongProperty(String key)
Deprecated.
Returns a property as a long value.
|
protected static JRPropertiesMap |
getOwnProperties(JRPropertiesHolder propertiesHolder)
Deprecated.
|
static List<JRProperties.PropertySuffix> |
getProperties(JRPropertiesHolder propertiesHolder,
String prefix)
Deprecated.
Returns the list of all properties for a key prefix.
|
static List<JRProperties.PropertySuffix> |
getProperties(JRPropertiesMap propertiesMap,
String prefix)
Deprecated.
Returns the list of all properties for a key prefix.
|
static List<JRProperties.PropertySuffix> |
getProperties(String prefix)
Deprecated.
Returns the list of all properties for a key prefix.
|
static String |
getProperty(JRPropertiesHolder propertiesHolder,
String key)
Deprecated.
Returns the value of a property, looking first in the supplied properties holder
and then in the system properties.
|
static String |
getProperty(JRPropertiesMap propertiesMap,
String key)
Deprecated.
Returns the value of a property, looking first in the supplied properties map
and then in the system properties.
|
static String |
getProperty(String key)
Deprecated.
Returns the value of the property.
|
static String |
getProperty(String key,
JRPropertiesHolder... propertiesHolders)
Deprecated.
Returns the value of a property, looking for it in several properties holders
and then in the system properties.
|
protected static String |
getSystemProperty(String propertyName)
Deprecated.
|
protected static void |
initProperties()
Deprecated.
Loads the properties.
|
static Properties |
loadProperties(String name,
Properties defaults)
Deprecated.
Loads a properties file from the classpath.
|
protected static void |
loadSystemProperties()
Deprecated.
|
protected static void |
loadSystemProperty(String sysKey,
String propKey)
Deprecated.
|
static void |
removePropertyValue(String key)
Deprecated.
Removes the value set for a property.
|
static void |
restoreProperties()
Deprecated.
Restores previously saved properties.
|
static void |
setProperty(String key,
boolean value)
Deprecated.
Sets the value of a property.
|
static void |
setProperty(String key,
String value)
Deprecated.
Sets the value of a property.
|
protected static void |
transfer(JRPropertiesMap source,
JRPropertiesHolder destination,
String tranferPropertiesPrefix)
Deprecated.
|
static void |
transferProperties(JRPropertiesHolder source,
JRPropertiesHolder destination,
String tranferPropertiesPrefix)
Deprecated.
Copies properties from one object to another.
|
static void |
transferProperties(JRPropertiesMap source,
JRPropertiesHolder destination,
String tranferPropertiesPrefix)
Deprecated.
Copies properties from one object to another.
|
protected static final String DEFAULT_PROPERTIES_FILE
DefaultJasperReportsContext.DEFAULT_PROPERTIES_FILE
.public static final String PROPERTY_PREFIX
JRPropertiesUtil.PROPERTY_PREFIX
.public static final String PROPERTIES_FILE
DefaultJasperReportsContext.PROPERTIES_FILE
.public static final String COMPILER_CLASS
JRCompiler.COMPILER_PREFIX
.No default value.
public static final String COMPILER_XML_VALIDATION
JRReportSaxParserFactory.COMPILER_XML_VALIDATION
.
Defaults to true
.
public static final String COMPILER_KEEP_JAVA_FILE
JRCompiler.COMPILER_KEEP_JAVA_FILE
.
Defaults to false
.
public static final String COMPILER_TEMP_DIR
JRCompiler.COMPILER_TEMP_DIR
.
Defaults to System.getProperty("user.dir")
.
public static final String COMPILER_CLASSPATH
JRCompiler.COMPILER_CLASSPATH
.
Defaults to System.getProperty("java.class.path")
.
public static final String EXPORT_XML_VALIDATION
PrintSaxParserFactory.EXPORT_XML_VALIDATION
.
Defaults to true
.
public static final String PDF_FONT_FILES_PREFIX
JRPdfExporter.PDF_FONT_FILES_PREFIX
.public static final String PDF_FONT_DIRS_PREFIX
JRPdfExporter.PDF_FONT_DIRS_PREFIX
.public static final String QUERY_EXECUTER_FACTORY_PREFIX
net.sf.jasperreports.engine.query
.protected static volatile ConcurrentHashMap<String,String> properties
protected static void initProperties()
protected static void loadSystemProperties()
protected static Properties getDefaults() throws JRException
JRException
protected static void loadSystemProperty(String sysKey, String propKey)
public static Properties loadProperties(String name, Properties defaults) throws JRException
name
- the resource namedefaults
- the default propertiesnull
otherwiseJRException
public static String getProperty(String key)
key
- the keypublic static boolean getBooleanProperty(String key)
key
- the keypublic static int getIntegerProperty(String key)
key
- the keypublic static float getFloatProperty(String key)
key
- the keypublic static boolean asBoolean(String value)
String
value into a boolean
.value
- the valueboolean
public static int asInteger(String value)
String
value into a int
.value
- the valueint
public static float asFloat(String value)
String
value into a float
.value
- the valuefloat
public static void setProperty(String key, String value)
key
- the keyvalue
- the valuepublic static void setProperty(String key, boolean value)
key
- the keyvalue
- the valuepublic static void removePropertyValue(String key)
This method removes values set in jasperreports.properties or via the
setProperty
method.
Built-in default property values are not affected; if the property has
a default value it will be used after calling this method for the
property.
key
- the property keypublic static void backupProperties()
restoreProperties()
public static void restoreProperties()
backupProperties()
public static List<JRProperties.PropertySuffix> getProperties(String prefix)
prefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuepublic static List<JRProperties.PropertySuffix> getProperties(JRPropertiesHolder propertiesHolder, String prefix)
propertiesHolder
- the properties holderprefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuegetAllProperties(JRPropertiesHolder, String)
public static List<JRProperties.PropertySuffix> getAllProperties(JRPropertiesHolder propertiesHolder, String prefix)
propertiesHolder
- the properties holderprefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuegetProperties(JRPropertiesHolder, String)
public static List<JRProperties.PropertySuffix> getProperties(JRPropertiesMap propertiesMap, 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 static List<JRProperties.PropertySuffix> getAllProperties(JRPropertiesMap propertiesMap, String prefix)
propertiesMap
- the properties mapprefix
- the key prefixPropertySuffix
objects containing the suffix of the key and the valuegetProperties(JRPropertiesMap, String)
public static String getProperty(JRPropertiesHolder propertiesHolder, String key)
propertiesHolder
- the properties holderkey
- the keypublic static String getProperty(String key, JRPropertiesHolder... propertiesHolders)
key
- the keypropertiesHolders
- the properties holderspublic static String getProperty(JRPropertiesMap propertiesMap, String key)
propertiesMap
- the properties mapkey
- the keypublic static boolean getBooleanProperty(JRPropertiesHolder propertiesHolder, String key, boolean defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not foundpublic static Boolean getBooleanProperty(JRPropertiesHolder propertiesHolder, String key)
propertiesHolder
- the properties holderkey
- the keynull
if the property is not definedpublic static boolean getBooleanProperty(JRPropertiesMap propertiesMap, String key, boolean defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not foundpublic static int getIntegerProperty(JRPropertiesHolder propertiesHolder, String key, int defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not foundpublic static int getIntegerProperty(JRPropertiesMap propertiesMap, String key, int defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not foundpublic static int getIntegerProperty(String key, int defaultValue)
key
- the keydefaultValue
- the default value used if the property is not foundpublic static float getFloatProperty(JRPropertiesHolder propertiesHolder, String key, float defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not foundpublic static float getFloatProperty(JRPropertiesMap propertiesMap, String key, float defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not foundpublic static float getFloatProperty(String key, float defaultValue)
key
- the keydefaultValue
- the default value used if the property is not foundpublic static long asLong(String value)
String
value into a long
.value
- the valuelong
public static long getLongProperty(String key)
key
- the keypublic static long getLongProperty(JRPropertiesMap propertiesMap, String key, int defaultValue)
propertiesMap
- the properties mapkey
- the keydefaultValue
- the default value used if the property is not foundpublic static long getLongProperty(JRPropertiesHolder propertiesHolder, String key, int defaultValue)
propertiesHolder
- the properties holderkey
- the keydefaultValue
- the default value used if the property is not foundprotected static JRPropertiesMap getOwnProperties(JRPropertiesHolder propertiesHolder)
public static 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 copypublic static 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 static void transfer(JRPropertiesMap source, JRPropertiesHolder destination, String tranferPropertiesPrefix)
public static Character getCharacterProperty(String key)
Character
value.key
- the keyCharacter
asCharacter(String)
public static 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 keyCharacter
public 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
valueCharacter
Copyright © 2013. All Rights Reserved.