Class ChainRule.Builder
java.lang.Object
com.streamconverter.command.rule.impl.composite.ChainRule.Builder
- Enclosing class:
ChainRule
Builder class for ChainRule configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a rule to the end of the chain.Adds multiple rules to the end of the chain.Adds multiple rules to the end of the chain.build()
Builds the ChainRule with current configuration.clear()
Removes all rules from the chain.insertRule
(int index, IRule rule) Inserts a rule at the specified position in the chain.int
size()
Gets the current number of rules in the builder.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addRule
Adds a rule to the end of the chain.- Parameters:
rule
- rule to add (null rules are ignored)- Returns:
- this builder
-
addRules
Adds multiple rules to the end of the chain.- Parameters:
rules
- rules to add (null rules are ignored)- Returns:
- this builder
-
addRules
Adds multiple rules to the end of the chain.- Parameters:
rules
- list of rules to add (null rules are ignored)- Returns:
- this builder
-
insertRule
Inserts a rule at the specified position in the chain.- Parameters:
index
- position to insert atrule
- rule to insert- Returns:
- this builder
- Throws:
IndexOutOfBoundsException
- if index is out of range
-
clear
Removes all rules from the chain.- Returns:
- this builder
-
size
Gets the current number of rules in the builder.- Returns:
- number of rules
-
build
Builds the ChainRule with current configuration.- Returns:
- configured rule instance
- Throws:
IllegalArgumentException
- if no rules have been added
-