@StableMinor(version="12.5", sinceVersion="5.0") public class PropertyBag extends Object
This is a property bag that contains name value pairs where name
is a string that is unique within a property bag and the value is
a Property
object.
A property bag may have a parent property bag from which it may inherit properties. Properties inherited from a parent property bag may be overridden in the child property bag.
Constructor and Description |
---|
PropertyBag() |
Modifier and Type | Method and Description |
---|---|
String |
getId()
Returns the identifier of this property bag.
|
Property |
getLocalProperty(String propertyName)
Returns a property in this property bag.
|
Map<String,Property> |
getLocalPropertyMap()
Returns all the properties in this property bag.
|
PropertyBag |
getParentPropertyBag()
Returns the parent property bag object.
|
Property |
getProperty(String propertyName)
Returns a property of this property bag.
|
Map<String,Property> |
getPropertyMap()
Returns the aggregated properties of this property bag.
|
String |
getValue(String propertyName,
String defaultValue)
Deprecated.
since 12.0.0 prefer
IPropertyBagManager.getValue(String, String, String) , that use a more optimized cache. |
Map<String,List<String>> |
getValueMap()
Deprecated.
since 12.0.0, prefer
IPropertyBagManager.getValueMap(String) , that use a more optimized cache. |
List<String> |
getValues(String propertyName,
List<String> defaultValues)
Deprecated.
since 12.0.0 prefer
IPropertyBagManager.getValues(String, String, List) , that use a more optimized cache. |
void |
removeProperty(String propertyName)
Removes a property from this property bag.
|
void |
resetDefaultValues(String propertyName)
Resets a property default values, so that it will be inherited from the
parent property bag.
|
void |
setDefaultValue(String propertyName,
String value)
Sets the default value for a property.
|
void |
setDefaultValues(String propertyName,
List<String> values)
Sets the default values for a property.
|
void |
setParentPropertyBag(PropertyBag parentPropertyBag)
Sets the parent property bag.
|
public String getId()
public PropertyBag getParentPropertyBag()
public void setParentPropertyBag(PropertyBag parentPropertyBag)
parentPropertyBag
- the parent property bag.public Map<String,Property> getLocalPropertyMap()
This method does not take into consideration the properties that may be inherited from the parent property bag.
getValueMap()
,
getPropertyMap()
public Property getLocalProperty(String propertyName) throws PortalException
Inherited properties are not returned.
propertyName
- name of the property to return.IllegalArgumentException
- if propertyName
is
null
.PortalObjectNotFoundException
- if no property with the given name
was found.PortalException
public Property getProperty(String propertyName) throws PortalException
The property may be an inherited property, from other property bag.
propertyName
- name of the property to return.IllegalArgumentException
- if propertyName
is
null
.PortalObjectNotFoundException
- if no property with the given name
was found.PortalException
getValue(String, String)
,
getValues(String, List)
public Map<String,Property> getPropertyMap()
If this property bag has a parent property bag, the properties of the parent are first called and subsequently the local properties are merged with the inherited ones. If there are properties with the same name, the local property is preserved discarding the inherited property.
getValueMap()
,
getLocalPropertyMap()
public void removeProperty(String propertyName) throws PortalException
propertyName
- name of the property to remove.IllegalArgumentException
- if propertyName
is
null
.PortalObjectNotFoundException
- if no property with the given name
was found.PortalException
@Deprecated public Map<String,List<String>> getValueMap()
IPropertyBagManager.getValueMap(String)
, that use a more optimized cache.The key of the map is the property name and the value of the map is the list of values for each property. If no property exist in this bag, this method returns an empty Map.
@Deprecated public String getValue(String propertyName, String defaultValue)
IPropertyBagManager.getValue(String, String, String)
, that use a more optimized cache.propertyName
- the property name.defaultValue
- the value to return if there is no value for the
property.IllegalArgumentException
- if propertyName
is
null
.@Deprecated public List<String> getValues(String propertyName, List<String> defaultValues)
IPropertyBagManager.getValues(String, String, List)
, that use a more optimized cache.propertyName
- the property name.defaultValues
- the values to return if there is no value for the
property.IllegalArgumentException
- if propertyName
is
null
.public void setDefaultValue(String propertyName, String value)
propertyName
- the property name.value
- the value. If null
, the default value will be
inherited. To set as no value and override inheritance, use
setDefaultValues(String, List)
.IllegalArgumentException
- if propertyName
or
value
is null
.public void setDefaultValues(String propertyName, List<String> values)
propertyName
- the property name.values
- the values. If it is an empty list, the property will
explicitly have no value (and will not inherit its parent's values).IllegalArgumentException
- if propertyName
or
values
is null
.public void resetDefaultValues(String propertyName)
propertyName
- the property name.IllegalArgumentException
- if propertyName
is null
.LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.