Interface CtAbstractSwitch<S>

Type Parameters:
S - the type of the selector expression
All Superinterfaces:
Cloneable, CtElement, CtQueryable, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder
All Known Subinterfaces:
CtSwitch<S>, CtSwitchExpression<T,​S>
All Known Implementing Classes:
CtSwitchExpressionImpl, CtSwitchImpl

public interface CtAbstractSwitch<S> extends CtElement
This code element defines an abstract switch (either switch statement or switch expression).
  • Method Details

    • getSelector

      CtExpression<S> getSelector()
      Gets the selector. The type of the Expression must be char, byte, short, int, Character, Byte, Short, Integer, or an enum type
    • setSelector

      <T extends CtAbstractSwitch<S>> T setSelector(CtExpression<S> selector)
      Sets the selector. The type of the Expression must be char, byte, short, int, Character, Byte, Short, Integer, or an enum type
    • getCases

      List<CtCase<? super S>> getCases()
      Gets the list of cases defined for this switch.
    • setCases

      <T extends CtAbstractSwitch<S>> T setCases(List<CtCase<? super S>> cases)
      Sets the list of cases defined for this switch.
    • addCase

      <T extends CtAbstractSwitch<S>> T addCase(CtCase<? super S> c)
      Adds a case;
    • addCaseAt

      <T extends CtAbstractSwitch<S>> T addCaseAt(int position, CtCase<? super S> c)
      Adds a case at the specified position.
      Type Parameters:
      T - type of the switch - CtSwitch or CtSwitchExpression
      Parameters:
      position - index at which the case needs to be inserted
      c - case which has to be inserted in the switch block
      Returns:
      switch block in which the case is inserted
    • removeCase

      boolean removeCase(CtCase<? super S> c)
      Removes a case;