Interface Dependency
- All Known Implementing Classes:
AbstractDependency,AbstractModifier,DependencyDependent,MappingOperationModifier,MappingOperationModifier.SpecialValue,OperationModifier,StaticValue,ValueImpl
public interface Dependency
A class with values that values of other classes depend on. A class with values depending on the implementing class
should implement
Dependent, and all dependents should be added to the class implementing this interface
with addDependent(Dependent) or addDependents(Collection). The implementation of these methods
must check for cyclic dependencies and throw IllegalArgumentException if one would be caused by the
operation.-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDependent(Dependent dependent) Register aDependentthat depends on this class.booleanaddDependents(Collection<? extends Dependent> dependencies) RegisterDependentsthat depends on this class.booleancontainsDependent(Dependent dependent) booleancontainsDependentRecursive(Dependent dependent) Checks if the specifiedDependentis registered to this class or any of its dependents that also implement dependent, recursively.booleancontainsDependents(Collection<? extends Dependent> dependents) booleancontainsDependentsRecursive(Collection<? extends Dependent> dependents) Checks if all the specifiedDependentsare registered to this class or any of its dependencies that also implement dependent, recursively.voidCallsDependent.invalidate()on allDependentsof this class.booleanremoveDependent(Dependent dependent) booleanremoveDependents(Collection<? extends Dependent> dependents)
-
Method Details
-
getDependents
Collection<Dependent> getDependents()- Returns:
- all
Dependentsthat depend on this class
-
invalidateDependents
void invalidateDependents()CallsDependent.invalidate()on allDependentsof this class. -
addDependent
Register aDependentthat depends on this class. The method must check for cyclic dependencies and throwIllegalArgumentExceptionif one is detected.- Parameters:
dependent-Dependentthat depends on this class- Returns:
trueif the registeredDependentschanged as a result of this operation- Throws:
IllegalArgumentException- if this operation would cause a cyclic dependency
-
addDependents
RegisterDependentsthat depends on this class. The method must check for cyclic dependencies and throwIllegalArgumentExceptionif one is detected.- Parameters:
dependencies-Dependenciesthat depend on this class- Returns:
trueif the registeredDependentschanged as a result of this operation- Throws:
IllegalArgumentException- if this operation would cause a cyclic dependency
-
removeDependent
- Parameters:
dependent-Dependentto be removed- Returns:
trueif the registeredDependentschanged as a result of this operation
-
removeDependents
- Parameters:
dependents-Dependentsto be removed- Returns:
trueif the registeredDependentschanged as a result of this operation
-
containsDependent
-
containsDependents
- Parameters:
dependents-Dependentsto be checked for- Returns:
trueif all the specifiedDependentsare registered to this class
-
containsDependentRecursive
Checks if the specifiedDependentis registered to this class or any of its dependents that also implement dependent, recursively. In practice any dependent that depends on this class, directly or indirectly, would cause this method to returntrue. -
containsDependentsRecursive
Checks if all the specifiedDependentsare registered to this class or any of its dependencies that also implement dependent, recursively. In practice any collection of dependencies that depend on this class, directly or indirectly, would cause this method to returntrue.- Parameters:
dependents-Dependenciesto be checked for- Returns:
trueif the specifiedDependenciesare registered to this class or any of its dependencies that also implement dependent, recursively
-
dependentStream
- Returns:
Streamof allDependentsthat are registered to this class
-
recursiveDependentStream
- Returns:
Streamof allDependentsthat are registered to this class or any of its dependents that also implement dependency, recursively
-