public interface PropertyCollection extends Serializable
Property
's. PropertyIO
. PropertyFrameworkGlobals
. PropertyCollectionRegistry.register(this);
", there by we can get all different collection using the PropertyCollectionRegistry.Property
,
PropertyIO
,
PropertyFrameworkGlobals
,
PropertyCollectionRegistry
Modifier and Type | Field and Description |
---|---|
static long |
PROPERTY_REGISTRY_DO_NOT_REGISTER
The value set for "getRegistryTimeout" if the PropertyCollection should not be registered on PropertyCollectionRegistry.
|
static long |
PROPERTY_REGISTRY_NO_TIMEOUT
The value set for "getRegistryTimeout" if the PropertyCollection should never timeout in PropertyCollectionRegistry (DEFAULT value).
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a
PropertyChangeListener to all registrered Property's in the PropertyCollection. |
PropertyIO |
getIo()
The PropertyIO.
|
Iterator<Property<?>> |
getIterator()
Property Iterator.
|
List<Property<?>> |
getList()
Property list sorted by name, as a
Collections.unmodifiableList . |
org.apache.commons.logging.Log |
getLogger()
The
org.apache.commons.logging.Log used. |
String |
getName()
Gets the name of the collection, default is getClass().getName();.
|
Property<?> |
getPropertyByName(String propertyName)
Get a Property by name.
|
PropertyValidationHandler |
getPropertyValidationHandler()
When a property collection validates all the properties it contains, then this handler defines what happens
in case the a property is valid or invalid.
|
long |
getRegistryTimeout()
The number of milliseconds before a PropertyCollection is automatically remove from PropertyCollectionRegistry.
|
void |
postValidation()
After the PropertyCollection has validation the PropertyIO and all the Properties, it calls this method.
|
void |
preValidation()
This method is called before any validation of PropertyIO and Properties is performed, this is where you typically can setup global configurations.
|
void |
reload()
Resets the cache typed values for all the
Property 's in the PropertyIO for this collection which forces a reload from the property IO. |
void |
removeAllPropertyChangeListeners()
Remove all PropertyChangeListener's from the Property's in the Collection.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a
PropertyChangeListener from all registered Property's in the collection. |
void |
setPropertyValidationHandler(PropertyValidationHandler propertyValidationHandler)
Here you can set your PropertyValidationHandler instance.
|
int |
size()
Number of properties.
|
void |
validate()
Validates all the
Property 's in the collection an throws an
PropertyException for the first that failsvalidation. |
List<PropertyValidationVO> |
validation()
Validates all the
Property 's in the collection, stores the result in
a java.util.List of PropertyValidationVO . |
static final long PROPERTY_REGISTRY_NO_TIMEOUT
static final long PROPERTY_REGISTRY_DO_NOT_REGISTER
String getName()
long getRegistryTimeout()
PropertyCollectionRegistry
void reload()
Property
's in the PropertyIO for this collection which forces a reload from the property IO.int size()
Property
's in the collection.void validate() throws PropertyException
Property
's in the collection an throws an
PropertyException
for the first that failsvalidation.PropertyException
- if any of the Property
's fails validation.List<PropertyValidationVO> validation()
Property
's in the collection, stores the result in
a java.util.List
of PropertyValidationVO
.
The purpose is for the client to have a list to show in any user interface the state of
properties.PropertyValidationVO
Property<?> getPropertyByName(String propertyName)
propertyName
- the name of the propertyProperty
if found, otherwise null
.org.apache.commons.logging.Log getLogger()
org.apache.commons.logging.Log
used.Iterator<Property<?>> getIterator()
Property
's in the collection.Iterator
List<Property<?>> getList()
Collections.unmodifiableList
.
Remember to sort before turning it in to a unmodifiableList list.Collections.unmodifiableList(List)
PropertyIO getIo()
Property
's has been initialized with.PropertyIO
PropertyValidationHandler getPropertyValidationHandler()
PropertyValidationHandler
of none is defined than LoggingPropertyValidationHandler
is used.PropertyValidationHandler
,
LoggingPropertyValidationHandler
void setPropertyValidationHandler(PropertyValidationHandler propertyValidationHandler)
propertyValidationHandler
- your instance of a PropertyValidationHandler.PropertyValidationHandler
void postValidation() throws PropertyException
public class MyPropertiesDemo extends PropertyStaticCollection implements MyProperties { public MyPropertiesDemo(FilePropertyIO io) { super(io); } public void postValidation() throws PropertyException { ActivationValidator activator = new ActivationValidator(); activator.given(MyProperties.PORT_NUMBER.getTypedValue()==443,MyProperties.A_SSL_CONFIG); activator.given(MyProperties.MY_STRING,MyProperties.MY_NUMBER_A,MyProperties.MY_NUMBER_B,MyProperties.MY_NUMBER_C,MyProperties.MY_NUMBER_D); } }It throws an exception
PropertyException
void preValidation()
void addPropertyChangeListener(PropertyChangeListener listener) throws NullPointerException
PropertyChangeListener
to all registrered Property's in the PropertyCollection. listener
- the listener to be added to all Property's.NullPointerException
- if listener was null
or the PropertyIO of the collection is null
.Property.addPropertyChangeListener(PropertyChangeListener)
,
LoggingPropertyValidationHandler
void removePropertyChangeListener(PropertyChangeListener listener) throws NullPointerException
PropertyChangeListener
from all registered Property's in the collection. listener
- the listener to be removed.NullPointerException
- if listener was null
or the PropertyIO of the collection is null
.Property.removePropertyChangeListener(PropertyChangeListener)
void removeAllPropertyChangeListeners()