|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deduced.AbstractPropertyCollection<K,V>
K
- the key typeV
- the value typepublic abstract class AbstractPropertyCollection<K,V>
AbstractPropertyCollection : this class implements a list of standard methods for a property collections
Nested Class Summary | |
---|---|
private static class |
AbstractPropertyCollection.CheckParent
Runnable class used to check for collections that weren't deleted properly. |
static class |
AbstractPropertyCollection.CollectionToDeleteMonitor
Collection To Delete Monitor |
Field Summary | |
---|---|
private static ActionInvoker |
ACTION_INVOKER
action invoker |
private static int |
CHECK_DELETE_MODE
current collection delete check mode |
static int |
CHECK_DELETE_MODE_AUTOMATIC
constant used to set the delete mode. |
static int |
CHECK_DELETE_MODE_MANUAL
constant used to set the delete mode. |
private static Runner |
CHECK_DELETE_RUNNER
runner that will invoke the delete check |
protected static AbstractPropertyCollection.CollectionToDeleteMonitor |
COLLECTION_TO_DELETE
collection to delete monitor |
private static boolean |
DELETE_CHECKED_ON_CLEAR_PARENT
flag used to enable or disable the warning generated when collections aren't deleted as expected. |
private java.lang.Object |
id
unique object ID |
private static java.util.concurrent.atomic.AtomicLong |
ID_ASSIGNER
object unique ID assigner |
private java.lang.Object |
keyOnParent
the key on parent |
private WeakList<PropertyListener<? super K,? super V>> |
listenerList
list of listeners on the current class. |
private static java.util.logging.Logger |
LOGGER
Logger |
private PropertyCollection<?,?> |
parent
the parent |
private static long |
serialVersionUID
serialization unique ID |
Fields inherited from interface org.deduced.PropertyCollection |
---|
PROPERTY_COLLECTION_TYPE |
Constructor Summary | |
---|---|
AbstractPropertyCollection()
default constructor |
Method Summary | ||
---|---|---|
void |
activate()
(non-Javadoc) |
|
private static void |
addCollectionToDelete(PropertyCollection<?,?> removedCollection)
Adds a collection that was recently removed from it's parent to the list of collections that should either get a new parent or be deleted. |
|
void |
addListener(PropertyListener<? super K,? super V> listener)
(non-Javadoc) |
|
java.util.List<Property<V>> |
asPropertyList()
(non-Javadoc) |
|
java.util.Map<K,Property<V>> |
asPropertyMap()
(non-Javadoc) |
|
java.util.List<V> |
asValueList()
(non-Javadoc) |
|
java.util.Map<K,V> |
asValueMap()
(non-Javadoc) |
|
protected AbstractPropertyCollection<K,V> |
callObjectClone()
call the object clone method |
|
protected static java.util.logging.Logger |
classLogger()
fetch the class logger |
|
protected void |
cleanNewlyClonedValue(AbstractPropertyCollection<K,V> newClone)
clean Newly Cloned Value before additional initialization steps are performed. |
|
void |
clear()
(non-Javadoc) |
|
static void |
clearCollectionMonitoredForDelete()
Clear the list of collections that should be deleted after their parent got reset. |
|
java.lang.Object |
clone()
(non-Javadoc) |
|
static
|
cloneCollection(T collectionToClone)
Utility method to clone a collection and cast it automatically in the right type |
|
boolean |
containsInstance(java.lang.Object instance)
(non-Javadoc) |
|
boolean |
containsValue(java.lang.Object value)
(non-Javadoc) |
|
private static java.lang.IllegalArgumentException |
createInvalidParentException()
create an invalid parent exception |
|
protected static java.lang.Object |
createUniqueID()
create Unique ID |
|
void |
delete()
(non-Javadoc) |
|
protected void |
deleteClearAllProperties()
step in the deletion process used to clear all the properties in the collection. |
|
protected void |
deleteClearListenerList()
step in the deletion process used to clear the list of listeners |
|
protected void |
deleteFireDeleteEvent()
step in the deletion process used to fire the delete event |
|
protected void |
deleteProcessCompletedValidation()
last step of the delete process where the collection is identified as properly deleted. |
|
protected void |
deleteRemoveLocalObjectFromParent()
step in the deletion process used to remove the current collection from its parent. |
|
protected void |
deleteValidateEmptyListenerList()
step in the deletion process used to verify that no listeners are left. |
|
protected void |
deleteValidateNoPendingReferences()
step in the deletion process used to verify that nobody is referencing the current collection |
|
boolean |
equals(java.lang.Object obj)
(non-Javadoc) |
|
void |
firePropertyChangeEvent(PropertyCollection<?,?> description,
K key,
V oldValue,
V newValue,
ChangeType type)
Fire a property change event. |
|
static void |
flushCollectionsWithNewParent()
check if all the collections flagged for deletion have been deleted correctly. |
|
static void |
flushCollectionsWithNewParent(boolean throwException)
check if all the collections flagged for deletion have been deleted correctly. |
|
static ActionInvoker |
getActionInvoker()
get Action Invoker |
|
static int |
getCheckDeleteMode()
|
|
protected static Runner |
getCheckDeleteRunner()
get Check Delete Runner |
|
PropertyCollection<?,?> |
getFixedInstance()
(non-Javadoc) |
|
static java.lang.Object |
getInstanceIdentityKey(java.lang.Object value)
fetch the instance identity code |
|
int |
hashCode()
(non-Javadoc) |
|
java.lang.Object |
id()
(non-JSDoc) |
|
K |
instanceKey(java.lang.Object instance)
(non-Javadoc) |
|
protected void |
internalFirePropertyChangeEvent(PropertyCollection<?,?> description,
K key,
V oldValue,
V newValue,
ChangeType type)
Fire a property change event. |
|
java.lang.Object |
invokeAction(java.lang.String actionName,
InvocationParameter[] parameters)
(non-JSDoc) |
|
boolean |
isActivated()
(non-Javadoc) |
|
static boolean |
isDeleteCheckedOnClearParent()
|
|
boolean |
isEmpty()
(non-Javadoc) |
|
boolean |
isListenerRegistered(PropertyListener<? super K,? super V> listener)
(non-Javadoc) |
|
protected static boolean |
isParentOrKeyNull(PropertyCollection<?,?> element)
test if the parent or the key on parent is null on a collection |
|
java.lang.Object |
keyOnParent()
(non-Javadoc) |
|
PropertyCollection<?,?> |
parent()
(non-Javadoc) |
|
void |
removeListener(PropertyListener<? super K,? super V> listener)
(non-Javadoc) |
|
static boolean |
requiresChangeEvent(java.lang.Object newValue,
java.lang.Object oldValue)
Check to see if a change event is required when a value is changing. |
|
static void |
setActionInvoker(ActionInvoker setInvoker)
set Action Invoker |
|
static void |
setCheckDeleteMode(int setCheckDeleteMode)
|
|
protected static void |
setCheckDeleteRunner(Runner setCheckDeleteRunner)
set Check Delete Runner |
|
static void |
setDeleteCheckedOnClearParent(boolean setDeleteCheckedOnClearParent)
|
|
void |
setFixedInstance(PropertyCollection<?,?> instance)
(non-JSDoc) |
|
void |
setParent(PropertyCollection<?,?> setParent,
java.lang.Object setKeyOnParent)
(non-Javadoc) |
|
java.lang.String |
toString()
(non-Javadoc) |
|
protected void |
updateReference(PropertyCollection<?,?> description,
K key,
V oldValue,
V newValue)
If reference tracking is enabled, this method will update a reference from the current collection. |
|
protected void |
updateReferenceWithReferenceFlag(K key,
V oldValue,
V newValue,
boolean isReference)
update Reference |
|
static void |
validateAllPropertyInstances(PropertyCollection<?,?> collectionToValidate,
PropertyInstance listFixedInstance)
validate that all the properties in a collection are of a specific instance. |
|
protected void |
validateNoListener(PropertyListener<? super K,? super V> invalidRef)
validate there is No Listener on the collection with a specific value |
|
protected void |
validateNoParentRecursion(PropertyCollection<?,?> parentToValidate)
validate that there is no recursion in the parent hierarchy. |
|
static void |
validateParentIsNull(java.lang.Object newValue)
validate if an object has a null parent. |
|
static void |
validateParentIsNull(PropertyCollection<?,?> newValue)
validate if a property collection has a null parent |
|
K |
valueKey(java.lang.Object value)
(non-Javadoc) |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.deduced.PropertyCollection |
---|
addProperty, areKeysAssignedAutomatically, asKeySet, containsKey, getProperty, getPropertyValue, iterator, iteratorByValue, removeProperty, removePropertyInstance, removePropertyValue, setProperty, size, type |
Field Detail |
---|
private static final long serialVersionUID
private static java.util.concurrent.atomic.AtomicLong ID_ASSIGNER
private static ActionInvoker ACTION_INVOKER
private static final java.util.logging.Logger LOGGER
private PropertyCollection<?,?> parent
private java.lang.Object keyOnParent
private java.lang.Object id
private transient WeakList<PropertyListener<? super K,? super V>> listenerList
protected static final AbstractPropertyCollection.CollectionToDeleteMonitor COLLECTION_TO_DELETE
public static final int CHECK_DELETE_MODE_AUTOMATIC
public static final int CHECK_DELETE_MODE_MANUAL
private static int CHECK_DELETE_MODE
private static Runner CHECK_DELETE_RUNNER
private static boolean DELETE_CHECKED_ON_CLEAR_PARENT
Constructor Detail |
---|
public AbstractPropertyCollection()
Method Detail |
---|
protected static java.lang.Object createUniqueID()
public java.lang.Object id()
id
in interface PropertyCollection<K,V>
PropertyCollection.id()
public void addListener(PropertyListener<? super K,? super V> listener)
addListener
in interface PropertyCollection<K,V>
listener
- the listener to addPropertyCollection.addListener(org.deduced.PropertyListener)
public void removeListener(PropertyListener<? super K,? super V> listener)
removeListener
in interface PropertyCollection<K,V>
listener
- the listener to removePropertyCollection.removeListener(org.deduced.PropertyListener)
public boolean isListenerRegistered(PropertyListener<? super K,? super V> listener)
isListenerRegistered
in interface PropertyCollection<K,V>
listener
- the listener to check
PropertyCollection.isListenerRegistered(org.deduced.PropertyListener)
public void firePropertyChangeEvent(PropertyCollection<?,?> description, K key, V oldValue, V newValue, ChangeType type)
description
- the property descriptionkey
- the property keyoldValue
- the old valuenewValue
- the new valuetype
- the type of changeprotected void internalFirePropertyChangeEvent(PropertyCollection<?,?> description, K key, V oldValue, V newValue, ChangeType type)
description
- the property descriptionkey
- the property keyoldValue
- the old valuenewValue
- the new valuetype
- the type of changeprotected void updateReference(PropertyCollection<?,?> description, K key, V oldValue, V newValue)
description
- the instance used to register the referencekey
- the property key for the referenceoldValue
- the previous referencenewValue
- the new referenceprotected void updateReferenceWithReferenceFlag(K key, V oldValue, V newValue, boolean isReference)
key
- the key being updatedoldValue
- the previous valuenewValue
- the new valueisReference
- flag indicating if the updated property is a referencepublic boolean containsInstance(java.lang.Object instance)
containsInstance
in interface PropertyCollection<K,V>
instance
- the object instance to look for in the collection.
PropertyCollection.containsInstance(java.lang.Object)
public boolean containsValue(java.lang.Object value)
containsValue
in interface PropertyCollection<K,V>
value
- the object value to look for in the collection.
PropertyCollection.containsValue(java.lang.Object)
public java.lang.Object clone()
clone
in interface PropertyCollection<K,V>
clone
in class java.lang.Object
Object.clone()
protected void cleanNewlyClonedValue(AbstractPropertyCollection<K,V> newClone)
newClone
- the newly created clone of the current collectionprotected AbstractPropertyCollection<K,V> callObjectClone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- if clone is not supportedpublic void clear()
clear
in interface PropertyCollection<K,V>
PropertyCollection.clear()
public static boolean requiresChangeEvent(java.lang.Object newValue, java.lang.Object oldValue)
newValue
- the new valueoldValue
- the old value
public PropertyCollection<?,?> parent()
parent
in interface PropertyCollection<K,V>
PropertyCollection.parent()
public java.lang.Object keyOnParent()
keyOnParent
in interface PropertyCollection<K,V>
PropertyCollection.keyOnParent()
public void setParent(PropertyCollection<?,?> setParent, java.lang.Object setKeyOnParent)
setParent
in interface PropertyCollection<K,V>
setParent
- The parent to set.setKeyOnParent
- the key on the parent to reference this objectPropertyCollection.setParent(org.deduced.PropertyCollection,
java.lang.Object)
protected void validateNoParentRecursion(PropertyCollection<?,?> parentToValidate)
parentToValidate
- the parent to validateprotected static java.util.logging.Logger classLogger()
private static void addCollectionToDelete(PropertyCollection<?,?> removedCollection)
removedCollection
- the removed collectionpublic static void flushCollectionsWithNewParent()
public static void clearCollectionMonitoredForDelete()
public static void flushCollectionsWithNewParent(boolean throwException)
throwException
- if set to true, an exception will be thrown when
there are collections that haven't been deleted.protected static boolean isParentOrKeyNull(PropertyCollection<?,?> element)
element
- the collection to test
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public java.util.List<Property<V>> asPropertyList()
asPropertyList
in interface PropertyCollection<K,V>
PropertyCollection.asPropertyList()
public java.util.List<V> asValueList()
asValueList
in interface PropertyCollection<K,V>
PropertyCollection.asValueList()
public java.util.Map<K,Property<V>> asPropertyMap()
asPropertyMap
in interface PropertyCollection<K,V>
PropertyCollection.asPropertyMap()
public java.util.Map<K,V> asValueMap()
asValueMap
in interface PropertyCollection<K,V>
PropertyCollection.asValueMap()
public boolean isEmpty()
isEmpty
in interface PropertyCollection<K,V>
PropertyCollection.isEmpty()
public K instanceKey(java.lang.Object instance)
instanceKey
in interface PropertyCollection<K,V>
instance
- the object instance
PropertyCollection.instanceKey(java.lang.Object)
public K valueKey(java.lang.Object value)
valueKey
in interface PropertyCollection<K,V>
value
- the value to check for
PropertyCollection.valueKey(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public void delete()
delete
in interface PropertyCollection<K,V>
PropertyCollection.delete()
protected void deleteClearListenerList()
protected void deleteFireDeleteEvent()
protected void deleteValidateNoPendingReferences()
protected void deleteRemoveLocalObjectFromParent()
protected void deleteValidateEmptyListenerList()
protected void validateNoListener(PropertyListener<? super K,? super V> invalidRef)
invalidRef
- the possible listener. Null indicates that it might
have been garbage collected.protected void deleteClearAllProperties()
protected void deleteProcessCompletedValidation()
public static <T extends PropertyCollection<?,?>> T cloneCollection(T collectionToClone)
T
- the type of the cloned collectioncollectionToClone
- the collection to clone
public static java.lang.Object getInstanceIdentityKey(java.lang.Object value)
value
- the value from which to fetch the identity code
public static void validateParentIsNull(java.lang.Object newValue)
newValue
- the new value that should have a null parentpublic static void validateParentIsNull(PropertyCollection<?,?> newValue)
newValue
- the new value that should have a null parentprivate static java.lang.IllegalArgumentException createInvalidParentException()
public void activate()
activate
in interface PropertyCollection<K,V>
PropertyCollection.activate()
public boolean isActivated()
isActivated
in interface PropertyCollection<K,V>
PropertyCollection.isActivated()
public PropertyCollection<?,?> getFixedInstance()
getFixedInstance
in interface PropertyCollection<K,V>
PropertyCollection.getFixedInstance()
public void setFixedInstance(PropertyCollection<?,?> instance)
setFixedInstance
in interface PropertyCollection<K,V>
instance
- the new fixed instancePropertyCollection.setFixedInstance(org.deduced.PropertyCollection)
public static void validateAllPropertyInstances(PropertyCollection<?,?> collectionToValidate, PropertyInstance listFixedInstance)
collectionToValidate
- the collection to validatelistFixedInstance
- the fixed instance of the collectionprotected static void setCheckDeleteRunner(Runner setCheckDeleteRunner)
setCheckDeleteRunner
- the runner used to check deleted collectionsprotected static Runner getCheckDeleteRunner()
public static void setDeleteCheckedOnClearParent(boolean setDeleteCheckedOnClearParent)
setDeleteCheckedOnClearParent
- option if Delete is Checked On Clear
Parentpublic static boolean isDeleteCheckedOnClearParent()
public static void setCheckDeleteMode(int setCheckDeleteMode)
setCheckDeleteMode
- the check delete mode to setpublic static int getCheckDeleteMode()
public java.lang.Object invokeAction(java.lang.String actionName, InvocationParameter[] parameters) throws java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.NullPointerException, CompilationFailedException, java.lang.IllegalStateException
invokeAction
in interface PropertyCollection<K,V>
actionName
- the action name to invokeparameters
- the list of parameter and value to invoke. Any
parameter not in this list will be assigned a default value.
If a parameter doesn't have a default value, an
InvocationTargetException will be thrown.
java.lang.IllegalArgumentException
- if some of the parameters are wrong or
missing or the action fails to compile.
java.lang.reflect.InvocationTargetException
- if the action code throws an exception.
java.lang.NullPointerException
- if the actionName parameter is null.
CompilationFailedException
- if action failed to compile.
java.lang.IllegalStateException
- if action isn't enabled.PropertyCollection.invokeAction(java.lang.String,
org.deduced.InvocationParameter[])
public static ActionInvoker getActionInvoker()
public static void setActionInvoker(ActionInvoker setInvoker)
setInvoker
- the new action invoker
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |