org.deduced
Interface PropertyCollection<K,V>

Type Parameters:
K - The key class type
V - The Value class type
All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
AbstractLanguageCollection, AbstractTextBuilder, AbstractTextCollection, Action, BigDecimalInitializationModel, BigIntegerInitializationModel, BooleanInitializationModel, ByteInitializationModel, CalendarInitializationModel, CharacterInitializationModel, CollectionTypeControllerPackage, CollectionTypeInformation, CompiledModel, Configuration, ConfiguredCollection, ContexedCollection, Context, ContextualPropertyCollection<K,V>, CreationInitializationModel, DeducedApplicationLayer, DeducedControllerLayer, DeducedControllerLayerExtension, DeducedControllerLayerLinkedCollection, DeducedModelLayer, DeducedModelLayerExtension, DeducedSchemaLayer, DeductionRule, DefaultPropertyCollectionControllerModel, DefaultPropertyControllerModel, DocumentedCollection, DoubleInitializationModel, EnabledPropertyCollection, EnumerationPropertyCollection, EnumerationPropertyType, EnumerationValidationModel, EnumerationValidator, ErrorMessageBasedValidator, FloatInitializationModel, Folder, FormattedMultilanguageTextBuilder, InitializationModel, InstanceReference, InstanceReferenceInitializationModel, IntegerInitializationModel, Language, LanguageSpecificTextConfiguration, LinkedValidationModel, LongInitializationModel, ManuallyOrderedInstanceReference, ManuallyOrderedParameter, ManuallyOrderedType, MultilanguageTextBuilder, MultilanguageTextConfiguration, NamedPropertyCollection, NullableValidationModel, NullableValidator, NumberValidationModel, NumberValidator, OrderedInstanceReference, OrderedInstanceReferenceList, OrderedParameter, OrderedParameterList, OrderedPropertyListType, OrderingPropertyCollectionType, Parameter, PropertyCollectionController, PropertyCollectionControllerModel, PropertyCollectionListInstance, PropertyCollectionType, PropertyController, PropertyControllerModel, PropertyInstance, PropertyPackage, PropertyType, ReferenceInitializationModel, SchemaAnalyzer, SchemaBasedApplicationLayer, ShortInitializationModel, SingleItemListFilter, StaticInstanceReference, StaticInstanceReferenceInitializationModel, StringInitializationModel, StringValidationModel, StringValidator, Task, TaskMonitor, TextConfiguration, TypeCreationValidationModel, TypeCreationValidator, TypedCollectionController, TypedCollectionListController, TypedControllerPackage, TypedControllerSchema, TypedPropertyController, TypeReferenceValidationModel, TypeReferenceValidator, Utilities, ValidationModel, Validator
All Known Implementing Classes:
AbstractLanguageCollectionImplementation, AbstractPropertyCollection, AbstractPropertyCollectionController, AbstractTextBuilderImplementation, AbstractTextCollectionImplementation, ActionImplementation, BigDecimalInitializationModelImplementation, BigIntegerInitializationModelImplementation, BooleanInitializationModelImplementation, ByteInitializationModelImplementation, CalendarInitializationModelImplementation, CharacterInitializationModelImplementation, CollectionTypeControllerPackageImplementation, CollectionTypeInformationImplementation, CompiledModelImplementation, ConfigurationImplementation, ConfiguredCollectionImplementation, ContexedCollectionImplementation, ContextImplementation, CreationInitializationModelImplementation, DeducedApplicationLayerImplementation, DeducedControllerLayerExtensionImplementation, DeducedControllerLayerExtensionImplementation.LooseParentPropertyList, DeducedControllerLayerImplementation, DeducedControllerLayerLinkedCollectionImplementation, DeducedModelLayerExtensionImplementation, DeducedModelLayerImplementation, DeducedSchemaLayerImplementation, DeductionRuleImplementation, DefaultPropertyCollectionControllerModelImplementation, DefaultPropertyControllerModelImplementation, DirectPropertyCollectionController, DirectPropertyController, DocumentedCollectionImplementation, DoubleInitializationModelImplementation, DynamicPropertyList, DynamicPropertyMap, EnabledPropertyCollectionImplementation, EnumerationPropertyCollectionImplementation, EnumerationPropertyTypeImplementation, EnumerationValidationModelImplementation, EnumerationValidatorImplementation, ErrorMessageBasedValidatorImplementation, FixedPropertyInstanceCollection, FloatInitializationModelImplementation, FlyWheelDynamicPropertyCollectionController, FlyWheelDynamicPropertyController, FlyWheelPropertyCollectionController, FlyWheelPropertyCollectionControllerList, FlyWheelPropertyController, FlyWheelPropertyControllerList, FolderImplementation, FormattedMultilanguageTextBuilderImplementation, IdPropertyMap, InitializationModelImplementation, InstanceReferenceImplementation, InstanceReferenceInitializationModelImplementation, IntegerInitializationModelImplementation, LanguageImplementation, LanguageSpecificTextConfigurationImplementation, LinkedValidationModelImplementation, LongInitializationModelImplementation, ManuallyOrderedInstanceReferenceImplementation, ManuallyOrderedParameterImplementation, ManuallyOrderedTypeImplementation, MultilanguageTextBuilderImplementation, MultilanguageTextConfigurationImplementation, NamedPropertyCollectionImplementation, NullableValidationModelImplementation, NullableValidatorImplementation, NumberValidationModelImplementation, NumberValidatorImplementation, OrderedInstanceReferenceImplementation, OrderedInstanceReferenceListImplementation, OrderedParameterImplementation, OrderedParameterListImplementation, OrderedPropertyListTypeImplementation, OrderingPropertyCollectionTypeImplementation, ParameterImplementation, PropertyCollectionControllerModelImplementation, PropertyCollectionListInstanceImplementation, PropertyCollectionTypeImplementation, PropertyControllerModelImplementation, PropertyInstanceImplementation, PropertyList, PropertyMap, PropertyPackageImplementation, PropertyTypeImplementation, ReferenceInitializationModelImplementation, SchemaAnalyzerImplementation, SchemaBasedApplicationLayerImplementation, ShortInitializationModelImplementation, SimplePropertyCollectionController, SingleItemListFilterImplementation, SingleListItemFilterImpl, StaticInstanceReferenceImplementation, StaticInstanceReferenceInitializationModelImplementation, StringInitializationModelImplementation, StringValidationModelImplementation, StringValidatorImplementation, TaskImplementation, TaskMonitorImplementation, TextConfigurationImplementation, TypeCreationValidationModelImplementation, TypeCreationValidatorImplementation, TypedCollectionControllerImplementation, TypedCollectionListControllerImplementation, TypedControllerPackageImplementation, TypedControllerSchemaImplementation, TypedPropertyControllerImplementation, TypeReferenceValidationModelImplementation, TypeReferenceValidatorImplementation, UtilitiesImplementation, ValidationModelImplementation, ValidatorImplementation

public interface PropertyCollection<K,V>
extends java.lang.Cloneable

PropertyCollection

Author:
Steve McDuff

Field Summary
static PropertyCollectionTypeHolder PROPERTY_COLLECTION_TYPE
          object holding the base property collection type object
 
Method Summary
 void activate()
          activate a collection that was created in a not activated state.
 void addListener(PropertyListener<? super K,? super V> listener)
          add a listener to the collection
 K addProperty(K key, PropertyCollection<?,?> instance, V value)
          add a property value
 boolean areKeysAssignedAutomatically()
           
 java.util.Set<K> asKeySet()
           
 java.util.List<Property<V>> asPropertyList()
           
 java.util.Map<K,Property<V>> asPropertyMap()
           
 java.util.List<V> asValueList()
           
 java.util.Map<K,V> asValueMap()
           
 void clear()
          clear the whole property list
 java.lang.Object clone()
          clone the object
 boolean containsInstance(java.lang.Object instance)
          test to see if the collection contains a specific object instance
 boolean containsKey(java.lang.Object key)
          test to see if the collection contains a specific Property key
 boolean containsValue(java.lang.Object value)
          test to see if the collection contains a specific object value
 void delete()
          delete this property collection
 PropertyCollection<?,?> getFixedInstance()
          Some collections use the same property instance for all their properties.
 Property<V> getProperty(java.lang.Object key)
          fetch a property
 V getPropertyValue(java.lang.Object key)
          fetch a property value
 java.lang.Object id()
          get the ID of the collection
 K instanceKey(java.lang.Object instance)
          get the object instance key that is contained in this map.
 java.lang.Object invokeAction(java.lang.String actionName, InvocationParameter[] parameters)
          invoke an Action by name
 boolean isActivated()
          check to see if the collection is activated
 boolean isEmpty()
           
 boolean isListenerRegistered(PropertyListener<? super K,? super V> listener)
          test to see if a listener is registered on the collection
 java.util.Iterator<Property<V>> iterator()
           
 java.util.Iterator<V> iteratorByValue()
           
 java.lang.Object keyOnParent()
           
 PropertyCollection<?,?> parent()
           
 void removeListener(PropertyListener<? super K,? super V> listener)
          remove a listener to the collection
 Property<V> removeProperty(java.lang.Object key)
          remove a property from the collection
 Property<V> removePropertyInstance(V instance)
          remove a property based on its instance.
 Property<V> removePropertyValue(V value)
          remove a property based on its value, it can be equal if it's by value, or just a reference.
 void setFixedInstance(PropertyCollection<?,?> instance)
          setFixedInstance
 void setParent(PropertyCollection<?,?> parent, java.lang.Object keyOnParent)
           
 V setProperty(K key, V value)
          set a property value
 int size()
          get collection Size
 PropertyCollection<?,?> type()
          fetch the property description of this collection
 K valueKey(java.lang.Object value)
          get the object value key that is contained in this map.
 

Field Detail

PROPERTY_COLLECTION_TYPE

static final PropertyCollectionTypeHolder PROPERTY_COLLECTION_TYPE
object holding the base property collection type object

Method Detail

addListener

void addListener(PropertyListener<? super K,? super V> listener)
add a listener to the collection

Parameters:
listener - the listener to add

removeListener

void removeListener(PropertyListener<? super K,? super V> listener)
remove a listener to the collection

Parameters:
listener - the listener to remove

isListenerRegistered

boolean isListenerRegistered(PropertyListener<? super K,? super V> listener)
test to see if a listener is registered on the collection

Parameters:
listener - the listener to check
Returns:
true if the listener is registered

type

PropertyCollection<?,?> type()
fetch the property description of this collection

Returns:
the property description

removeProperty

Property<V> removeProperty(java.lang.Object key)
remove a property from the collection

Parameters:
key - the key of the property
Returns:
the removed property, null if remove failed

removePropertyValue

Property<V> removePropertyValue(V value)
remove a property based on its value, it can be equal if it's by value, or just a reference.

Parameters:
value - the value to remove
Returns:
the removed object

removePropertyInstance

Property<V> removePropertyInstance(V instance)
remove a property based on its instance.

Parameters:
instance - the object to remove
Returns:
the removed object

getProperty

Property<V> getProperty(java.lang.Object key)
fetch a property

Parameters:
key - the property key
Returns:
the property, null if the get failed

containsKey

boolean containsKey(java.lang.Object key)
test to see if the collection contains a specific Property key

Parameters:
key - the property key
Returns:
true if the key is contained in this collection

containsInstance

boolean containsInstance(java.lang.Object instance)
test to see if the collection contains a specific object instance

Parameters:
instance - the object instance to look for in the collection.
Returns:
true if the instance is contained in this collection

containsValue

boolean containsValue(java.lang.Object value)
test to see if the collection contains a specific object value

Parameters:
value - the object value to look for in the collection.
Returns:
true if the value is contained in this collection

getPropertyValue

V getPropertyValue(java.lang.Object key)
fetch a property value

Parameters:
key - the property key
Returns:
the property value, null if the get failed

setProperty

V setProperty(K key,
              V value)
set a property value

Parameters:
key - the key of the property
value - the new value of the property. If the property is a collection that is not by reference, this method requires that the passed collection has a parent set to null since it will reset the parent.
Returns:
the added value instance

addProperty

K addProperty(K key,
              PropertyCollection<?,?> instance,
              V value)
add a property value

Parameters:
key - the key of the property. Some collections assign keys automatically, for those collections, a null value is expected. If the key is specified when they are assigned automatically, an IllegalArgumentException will be thrown
instance - the property instance to add. Most collections assign the instance automatically, for those collections, the instance can either be null or be the same as the instance that is automatically assigned, otherwise an error will be thrown
value - the property value. If the value is a property collection, then the collection is expected to have a null parent if the instance is owned (not by reference), otherwise an IllegalArgumentException will be thrown
Returns:
the added property key

iterator

java.util.Iterator<Property<V>> iterator()
Returns:
an iterator that iterates through the Property objects

iteratorByValue

java.util.Iterator<V> iteratorByValue()
Returns:
an iterator that iterates through the Property values

size

int size()
get collection Size

Returns:
the collection size

clear

void clear()
clear the whole property list


clone

java.lang.Object clone()
clone the object

Returns:
the object clone

parent

PropertyCollection<?,?> parent()
Returns:
Returns the parent.

keyOnParent

java.lang.Object keyOnParent()
Returns:
the key on the parent

setParent

void setParent(PropertyCollection<?,?> parent,
               java.lang.Object keyOnParent)
Parameters:
parent - The parent to set.
keyOnParent - the key on the parent to reference this object

asPropertyList

java.util.List<Property<V>> asPropertyList()
Returns:
the property collection as a list of Property objects

asValueList

java.util.List<V> asValueList()
Returns:
the property collection as a list of values

asKeySet

java.util.Set<K> asKeySet()
Returns:
a list containing all the keys in this property collection

asPropertyMap

java.util.Map<K,Property<V>> asPropertyMap()
Returns:
the map containing a list of property objects

asValueMap

java.util.Map<K,V> asValueMap()
Returns:
the map containing the values in the collection

isEmpty

boolean isEmpty()
Returns:
true if the collection is empty

valueKey

K valueKey(java.lang.Object value)
get the object value key that is contained in this map. If the object is contained by reference, it returns the instance key, if the object is by value, it returns the object which equals the specified value.

Parameters:
value - the value to check for
Returns:
the key representing the value

instanceKey

K instanceKey(java.lang.Object instance)
get the object instance key that is contained in this map. If this collection contains the same instance multiple times as reference, the returned key will be one of those instances. There is no guarantee which one of the references will be returned.

Parameters:
instance - the object instance
Returns:
the key of this instance

areKeysAssignedAutomatically

boolean areKeysAssignedAutomatically()
Returns:
true if the keys are assigned automatically by the collection

delete

void delete()
delete this property collection


activate

void activate()
activate a collection that was created in a not activated state. This is useful when creating collections that shouldn't apply their deductions rules right away (for instance, while streaming in a list of collections from XML)


isActivated

boolean isActivated()
check to see if the collection is activated

Returns:
true if the collection is activated

getFixedInstance

PropertyCollection<?,?> getFixedInstance()
Some collections use the same property instance for all their properties. This is usually the case with lists and maps.

Returns:
the fixed instance. Null if there is no fixed instance.

setFixedInstance

void setFixedInstance(PropertyCollection<?,?> instance)
setFixedInstance

Parameters:
instance - the new fixed instance

invokeAction

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
invoke an Action by name

Parameters:
actionName - the action name to invoke
parameters - 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.
Returns:
the action return value
Throws:
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.

id

java.lang.Object id()
get the ID of the collection

Returns:
the collection ID