Package ej.property.registry
Class SimplePropertyRegistry
- java.lang.Object
-
- ej.property.registry.SimplePropertyRegistry
-
- All Implemented Interfaces:
PropertyLoader,PropertyRegistry
public class SimplePropertyRegistry extends java.lang.Object implements PropertyRegistry
Simple implementation of a property registry.
-
-
Constructor Summary
Constructors Constructor Description SimplePropertyRegistry()Creates a simple property registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckPropertyPermission(java.lang.String key, java.lang.String action)Checks that an action on a property is permitted.java.lang.StringgetProperty(java.lang.String key)Gets the value mapped with the specified key.java.lang.StringgetProperty(java.lang.String key, java.lang.String defaultValue)Gets the value mapped with the specified key or a default value.java.lang.StringremoveProperty(java.lang.String key)Removes a property.java.lang.StringsetProperty(java.lang.String key, java.lang.String value)Sets a property that maps a key to a value.
-
-
-
Method Detail
-
getProperty
@Nullable public java.lang.String getProperty(java.lang.String key)
Description copied from interface:PropertyLoaderGets the value mapped with the specified key.- Specified by:
getPropertyin interfacePropertyLoader- Parameters:
key- the key.- Returns:
- the value of the property, or
nullif the property is not found.
-
getProperty
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)Description copied from interface:PropertyLoaderGets the value mapped with the specified key or a default value.- Specified by:
getPropertyin interfacePropertyLoader- Parameters:
key- the key.defaultValue- the default value.- Returns:
- the value of the property, or the default value if the property is not found.
-
setProperty
@Nullable public java.lang.String setProperty(java.lang.String key, java.lang.String value)Description copied from interface:PropertyRegistrySets a property that maps a key to a value.- Specified by:
setPropertyin interfacePropertyRegistry- Parameters:
key- the key.value- the value.- Returns:
- the previous value of the property, or
nullif the property is not found.
-
removeProperty
@Nullable public java.lang.String removeProperty(java.lang.String key)
Description copied from interface:PropertyRegistryRemoves a property.- Specified by:
removePropertyin interfacePropertyRegistry- Parameters:
key- the key.- Returns:
- the value of the property, or
nullif the property is not found.
-
checkPropertyPermission
protected void checkPropertyPermission(java.lang.String key, java.lang.String action)Checks that an action on a property is permitted.- Parameters:
key- the property key.action- the action.
-
-