Package org.apache.directory.api.util
Class MandatoryAndOptionalComponentsMonitor
- java.lang.Object
-
- org.apache.directory.api.util.MandatoryAndOptionalComponentsMonitor
-
- All Implemented Interfaces:
ComponentsMonitor
public class MandatoryAndOptionalComponentsMonitor extends Object implements ComponentsMonitor
A monitor that tracks both, mandatory and optional components.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description MandatoryAndOptionalComponentsMonitor(String[] mandatoryComponents, String[] optionalComponents)Instantiates a new mandatory and optional components monitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallComponentsUsed()Check if all components are used.booleanfinalStateValid()Checks if the final state is valid.List<String>getRemainingComponents()Gets the remaining components.ComponentsMonitoruseComponent(String component)Use a component.
-
-
-
Constructor Detail
-
MandatoryAndOptionalComponentsMonitor
public MandatoryAndOptionalComponentsMonitor(String[] mandatoryComponents, String[] optionalComponents)
Instantiates a new mandatory and optional components monitor. The mandatory and optional components must be disjunct.- Parameters:
mandatoryComponents- the mandatory componentsoptionalComponents- the optional components- Throws:
IllegalArgumentException- if the same component is defined as mandatory and optional
-
-
Method Detail
-
useComponent
public ComponentsMonitor useComponent(String component)
Use a component.- Specified by:
useComponentin interfaceComponentsMonitor- Parameters:
component- the component- Returns:
- this components monitor
-
allComponentsUsed
public boolean allComponentsUsed()
Check if all components are used.- Specified by:
allComponentsUsedin interfaceComponentsMonitor- Returns:
- true if all components are used
-
finalStateValid
public boolean finalStateValid()
Checks if the final state is valid. That depends whether the components are mandatory or optional.- Specified by:
finalStateValidin interfaceComponentsMonitor- Returns:
- true if the final state is valid
-
getRemainingComponents
public List<String> getRemainingComponents()
Gets the remaining components.- Specified by:
getRemainingComponentsin interfaceComponentsMonitor- Returns:
- the remaining components
-
-