Package net.sf.jasperreports.engine
Class JRPropertiesMap
- java.lang.Object
-
- net.sf.jasperreports.engine.JRPropertiesMap
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class JRPropertiesMap extends java.lang.Object implements java.io.Serializable, java.lang.CloneableProperties map of an JR element. The order of the properties (obtained bygetPropertyNames()is the same as the order in which the properties were added.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROPERTY_VALUEDeprecated.no longer used,setProperty(String, String)now uses the actual property name for the change event
-
Constructor Summary
Constructors Constructor Description JRPropertiesMap()Creates a properties map.JRPropertiesMap(JRPropertiesMap propertiesMap)Clones a properties map.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()JRPropertiesMapcloneProperties()Clones this property map.protected voidcollectPropertyNames(java.util.Collection<java.lang.String> names)booleancontainsProperty(java.lang.String propName)Decides whether the map contains a specified property.voidcopyOwnProperties(JRPropertiesMap propertiesMap)Copies own properties of a different map into this object.voidcopyProperties(JRPropertiesMap propertiesMap)Copies properties of a different map into this object.protected voidensureInit()JRPropertiesMapgetBaseProperties()Returns the base properties map, if any.JRPropertyChangeSupportgetEventSupport()protected java.lang.StringgetOwnProperty(java.lang.String propName)java.lang.String[]getOwnPropertyNames()static JRPropertiesMapgetPropertiesClone(JRPropertiesHolder propertiesHolder)Clones the properties map of a properties holder.java.lang.StringgetProperty(java.lang.String propName)Returns the value of a property.java.lang.String[]getPropertyNames()Returns the names of the properties.protected booleanhasEventSupport()booleanhasOwnProperties()Checks whether this object has properties of its own (i.e.protected booleanhasOwnProperty(java.lang.String propName)booleanhasProperties()Checks whether there are any properties.booleanisEmpty()static JRPropertiesMaploadProperties(java.net.URL location)Loads a properties file from a location.voidremoveProperty(java.lang.String propName)Removes a property.voidsetBaseProperties(JRPropertiesMap base)Sets the base properties map.voidsetProperty(java.lang.String propName, java.lang.String value)Adds/sets a property value.java.lang.StringtoString()
-
-
-
Field Detail
-
PROPERTY_VALUE
@Deprecated public static final java.lang.String PROPERTY_VALUE
Deprecated.no longer used,setProperty(String, String)now uses the actual property name for the change event- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JRPropertiesMap
public JRPropertiesMap()
Creates a properties map.
-
JRPropertiesMap
public JRPropertiesMap(JRPropertiesMap propertiesMap)
Clones a properties map.- Parameters:
propertiesMap- the original properties map
-
-
Method Detail
-
ensureInit
protected void ensureInit()
-
getPropertyNames
public java.lang.String[] getPropertyNames()
Returns the names of the properties.- Returns:
- the names of the properties
-
getOwnPropertyNames
public java.lang.String[] getOwnPropertyNames()
-
collectPropertyNames
protected void collectPropertyNames(java.util.Collection<java.lang.String> names)
-
getProperty
public java.lang.String getProperty(java.lang.String propName)
Returns the value of a property.- Parameters:
propName- the name of the property- Returns:
- the value
-
containsProperty
public boolean containsProperty(java.lang.String propName)
Decides whether the map contains a specified property. The method returns true even if the property value is null.- Parameters:
propName- the property name- Returns:
trueif and only if the map contains the property
-
hasOwnProperty
protected boolean hasOwnProperty(java.lang.String propName)
-
getOwnProperty
protected java.lang.String getOwnProperty(java.lang.String propName)
-
setProperty
public void setProperty(java.lang.String propName, java.lang.String value)Adds/sets a property value.- Parameters:
propName- the name of the propertyvalue- the value of the property
-
removeProperty
public void removeProperty(java.lang.String propName)
Removes a property.- Parameters:
propName- the property name
-
cloneProperties
public JRPropertiesMap cloneProperties()
Clones this property map.- Returns:
- a clone of this property map
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
copyOwnProperties
public void copyOwnProperties(JRPropertiesMap propertiesMap)
Copies own properties of a different map into this object.- Parameters:
propertiesMap- the map to copy properties from
-
copyProperties
public void copyProperties(JRPropertiesMap propertiesMap)
Copies properties of a different map into this object.- Parameters:
propertiesMap- the map to copy properties from
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hasProperties
public boolean hasProperties()
Checks whether there are any properties.- Returns:
- whether there are any properties
-
isEmpty
public boolean isEmpty()
-
hasOwnProperties
public boolean hasOwnProperties()
Checks whether this object has properties of its own (i.e. not inherited from the base properties).- Returns:
- whether this object has properties of its own
- See Also:
setBaseProperties(JRPropertiesMap)
-
getPropertiesClone
public static JRPropertiesMap getPropertiesClone(JRPropertiesHolder propertiesHolder)
Clones the properties map of a properties holder. If the holder does not have any properties, null is returned.- Parameters:
propertiesHolder- the properties holder- Returns:
- a clone of the holder's properties map, or
nullif the holder does not have any properties
-
getBaseProperties
public JRPropertiesMap getBaseProperties()
Returns the base properties map, if any.- Returns:
- the base properties map
- See Also:
setBaseProperties(JRPropertiesMap)
-
setBaseProperties
public void setBaseProperties(JRPropertiesMap base)
Sets the base properties map.The base properties map are used as base/default properties for this instance. All of the
containsProperty(String),getProperty(String),getPropertyNames()andhasProperties()methods include base properties as well.- Parameters:
base- the base properties map
-
loadProperties
public static JRPropertiesMap loadProperties(java.net.URL location)
Loads a properties file from a location.- Parameters:
location- the properties file URL- Returns:
- the properties file loaded as a in-memory properties map
-
hasEventSupport
protected boolean hasEventSupport()
-
getEventSupport
public JRPropertyChangeSupport getEventSupport()
-
-