Class ChainRule.Builder

java.lang.Object
com.streamconverter.command.rule.impl.composite.ChainRule.Builder
Enclosing class:
ChainRule

public static class ChainRule.Builder extends Object
Builder class for ChainRule configuration.
  • Constructor Details

  • 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

      public ChainRule.Builder addRules(IRule... rules)
      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

      public ChainRule.Builder insertRule(int index, IRule rule)
      Inserts a rule at the specified position in the chain.
      Parameters:
      index - position to insert at
      rule - 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

      public int size()
      Gets the current number of rules in the builder.
      Returns:
      number of rules
    • build

      public ChainRule build()
      Builds the ChainRule with current configuration.
      Returns:
      configured rule instance
      Throws:
      IllegalArgumentException - if no rules have been added