Class UnityPropertiesHelper
java.lang.Object
eu.unicore.util.configuration.PropertiesHelper
pl.edu.icm.unity.engine.api.config.UnityPropertiesHelper
- All Implemented Interfaces:
eu.unicore.util.configuration.PropertiesHelperAPI
,eu.unicore.util.configuration.UpdateableConfiguration
,Cloneable
public class UnityPropertiesHelper
extends eu.unicore.util.configuration.PropertiesHelper
Extends
PropertiesHelper
with Unity specific methods: returning localized strings
and caching of getSortedStringKeys(String, boolean)
method results.- Author:
- K. Benedyczak
-
Field Summary
Fields inherited from class eu.unicore.util.configuration.PropertiesHelper
genericListeners, log, metadata, prefix, properties, propertyFocusedListeners, structuredPrefixes
-
Constructor Summary
ModifierConstructorDescriptionUnityPropertiesHelper
(String prefix, Properties properties, Map<String, eu.unicore.util.configuration.PropertyMD> propertiesMD, org.apache.logging.log4j.Logger log) protected
For cloning -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCachedPrefixes
(String... prefixRegexp) All properties which start with the given regexp will be cached in a way that all properties starting with this prefix can be quickly retrieved usinggetSortedStringKeys(String, boolean)
.protected void
cacheIfNeeded
(String key) pl.edu.icm.unity.base.i18n.I18nString
getLocalizedString
(pl.edu.icm.unity.base.message.MessageSource msg, String baseKey) pl.edu.icm.unity.base.i18n.I18nString
getLocalizedStringWithoutFallbackToDefault
(pl.edu.icm.unity.base.message.MessageSource msg, String baseKey) getLocalizedValueWithOutFallbackToDefault
(String key, Locale locale) getSortedStringKeys
(String base, boolean allowListSubKeys) protected boolean
static Properties
protected void
void
setProperties
(Properties properties) void
setProperty
(String key, String value) Methods inherited from class eu.unicore.util.configuration.PropertiesHelper
addPropertyChangeListener, canHaveSubkeys, checkBounds, checkConstraints, checkConstraints, checkDeprecated, checkPropertyConstraints, checkStructuredListConstraints, clone, cloneTo, filterChanged, findUnknown, getBooleanValue, getClassValue, getDoubleValue, getDoubleValueNoCheck, getEnumValue, getFileValue, getFileValueAsString, getIntValue, getIntValueNoCheck, getKeyDescription, getListOfValues, getLocalizedValue, getLongValue, getLongValueNoCheck, getMetadata, getMetadataKey, getRawProperty, getSortedNumKeys, getStructuredListKeys, getSubkeyBooleanValue, getSubkeyEnumValue, getSubkeyIntValue, getSubkeyLongValue, getSubkeyValue, getValue, isSet, logValue, notifyAllWithKey, notifyFocusedListeners, notifyGenericListeners, removePropertyChangeListener
-
Field Details
-
listKeysCache
-
-
Constructor Details
-
UnityPropertiesHelper
public UnityPropertiesHelper(String prefix, Properties properties, Map<String, eu.unicore.util.configuration.PropertyMD> propertiesMD, org.apache.logging.log4j.Logger log) -
UnityPropertiesHelper
For cloning- Parameters:
cloned
-
-
-
Method Details
-
addCachedPrefixes
All properties which start with the given regexp will be cached in a way that all properties starting with this prefix can be quickly retrieved usinggetSortedStringKeys(String, boolean)
. This also optimizes uses ofPropertiesHelper.getListOfValues(String)
which relies on the above methods. Note that the regexp must include the main prefix of this properties object.- Parameters:
prefixRegexp
-
-
setProperties
- Specified by:
setProperties
in interfaceeu.unicore.util.configuration.PropertiesHelperAPI
- Specified by:
setProperties
in interfaceeu.unicore.util.configuration.UpdateableConfiguration
- Overrides:
setProperties
in classeu.unicore.util.configuration.PropertiesHelper
-
setProperty
- Specified by:
setProperty
in interfaceeu.unicore.util.configuration.PropertiesHelperAPI
- Overrides:
setProperty
in classeu.unicore.util.configuration.PropertiesHelper
-
refillCache
protected void refillCache() -
cacheIfNeeded
-
isCached
-
getSortedStringKeys
- Overrides:
getSortedStringKeys
in classeu.unicore.util.configuration.PropertiesHelper
-
getLocalizedString
public pl.edu.icm.unity.base.i18n.I18nString getLocalizedString(pl.edu.icm.unity.base.message.MessageSource msg, String baseKey) - Parameters:
msg
-baseKey
- Property name (without the prefix).- Returns:
- localized string of the given property. Default value is set to the regular value of the property. All sub values of the base key are used as localized values, assuming their subkey is equal to one of supported locales.
-
getLocalizedStringWithoutFallbackToDefault
public pl.edu.icm.unity.base.i18n.I18nString getLocalizedStringWithoutFallbackToDefault(pl.edu.icm.unity.base.message.MessageSource msg, String baseKey) -
getLocalizedValueWithOutFallbackToDefault
-
getAsString
-
parse
-