Package org.axonframework.modelling.saga
Class AssociationValuesImpl
java.lang.Object
org.axonframework.modelling.saga.AssociationValuesImpl
- All Implemented Interfaces:
Serializable,Iterable<AssociationValue>,AssociationValues
Default implementation of the AssociationValues interface. Note that this implementation is meant to be used by
a single thread at a time.
- Since:
- 0.7
- Author:
- Allard Buijze
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new AssociationValues object without initial associations.AssociationValuesImpl(Set<AssociationValue> initialValues) Initializes a new AssociationValues object with given initial associations. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(AssociationValue associationValue) Adds the givenassociationValue, if it has not been previously added.Returns the Set of association values that have been added since the lastAssociationValues.commit().asSet()Returns this instance as a Set of Association Values.voidcommit()Resets the tracked changes.booleancontains(AssociationValue associationValue) Indicates whether this instance contains the givenassociationValue.iterator()booleanremove(AssociationValue associationValue) Removes the givenassociationValue, if it is contained by this instance.Returns the Set of association values that have been removed since the lastAssociationValues.commit().intsize()Returns the number of AssociationValue instances available in this containerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AssociationValuesImpl
public AssociationValuesImpl()Initializes a new AssociationValues object without initial associations. -
AssociationValuesImpl
Initializes a new AssociationValues object with given initial associations.- Parameters:
initialValues- initial set of association values
-
-
Method Details
-
size
public int size()Description copied from interface:AssociationValuesReturns the number of AssociationValue instances available in this container- Specified by:
sizein interfaceAssociationValues- Returns:
- the number of AssociationValue instances available
-
contains
Description copied from interface:AssociationValuesIndicates whether this instance contains the givenassociationValue.- Specified by:
containsin interfaceAssociationValues- Parameters:
associationValue- the association value to verify- Returns:
trueif the association value is available in this instance, otherwisefalse
-
iterator
- Specified by:
iteratorin interfaceIterable<AssociationValue>
-
add
Description copied from interface:AssociationValuesAdds the givenassociationValue, if it has not been previously added. When added (method returnstrue), the givenassociationValuewill be returned on the next call toAssociationValues.addedAssociations(), unless it has been removed after the last call toAssociationValues.removedAssociations().- Specified by:
addin interfaceAssociationValues- Parameters:
associationValue- The association value to add- Returns:
trueif the value was added,falseif it was already contained in this instance
-
remove
Description copied from interface:AssociationValuesRemoves the givenassociationValue, if it is contained by this instance. When removed (method returnstrue), the givenassociationValuewill be returned on the next call toAssociationValues.removedAssociations(), unless it has been added after the last call toAssociationValues.addedAssociations().- Specified by:
removein interfaceAssociationValues- Parameters:
associationValue- The association value to remove- Returns:
trueif the value was removed,falseif it was not contained in this instance
-
asSet
Description copied from interface:AssociationValuesReturns this instance as a Set of Association Values. The returned set is a read-only view on this container. Any changes made to the container after this invocation may be reflected in the returned Set.- Specified by:
asSetin interfaceAssociationValues- Returns:
- a read only view on the contents of this container
-
removedAssociations
Description copied from interface:AssociationValuesReturns the Set of association values that have been removed since the lastAssociationValues.commit(). If an association was added and then removed (or vice versa), without any calls toAssociationValues.commit()in between, it is not returned.- Specified by:
removedAssociationsin interfaceAssociationValues- Returns:
- the Set of association values removed since the last
AssociationValues.commit().
-
addedAssociations
Description copied from interface:AssociationValuesReturns the Set of association values that have been added since the lastAssociationValues.commit(). If an association was added and then removed (or vice versa), without any calls toAssociationValues.commit()in between, it is not returned.- Specified by:
addedAssociationsin interfaceAssociationValues- Returns:
- the Set of association values added since the last
AssociationValues.commit().
-
commit
public void commit()Description copied from interface:AssociationValuesResets the tracked changes.- Specified by:
commitin interfaceAssociationValues
-