Class CtIfImpl

All Implemented Interfaces:
Serializable, Cloneable, FactoryAccessor, CtCodeElement, CtIf, CtStatement, SourcePositionHolder, CtElement, CtQueryable, CtVisitable, TemplateParameter<Void>

public class CtIfImpl extends CtStatementImpl implements CtIf
See Also:
Serialized Form
  • Constructor Details

    • CtIfImpl

      public CtIfImpl()
  • Method Details

    • accept

      public void accept(CtVisitor visitor)
      Description copied from interface: CtVisitable
      Accepts a visitor
      Specified by:
      accept in interface CtVisitable
    • getCondition

      public CtExpression<Boolean> getCondition()
      Description copied from interface: CtIf
      Gets the boolean expression that represents the if's condition.
      Specified by:
      getCondition in interface CtIf
    • getElseStatement

      public <S extends CtStatement> S getElseStatement()
      Description copied from interface: CtIf
      Gets the statement executed when the condition is false.
      Specified by:
      getElseStatement in interface CtIf
    • getThenStatement

      public <S extends CtStatement> S getThenStatement()
      Description copied from interface: CtIf
      Gets the statement executed when the condition is true.
      Specified by:
      getThenStatement in interface CtIf
    • setCondition

      public <T extends CtIf> T setCondition(CtExpression<Boolean> condition)
      Description copied from interface: CtIf
      Sets the boolean expression that represents the if's condition.
      Specified by:
      setCondition in interface CtIf
    • setElseStatement

      public <T extends CtIf> T setElseStatement(CtStatement elseStatement)
      Description copied from interface: CtIf
      Sets the statement executed when the condition is false.
      Specified by:
      setElseStatement in interface CtIf
    • setThenStatement

      public <T extends CtIf> T setThenStatement(CtStatement thenStatement)
      Description copied from interface: CtIf
      Sets the statement executed when the condition is true.
      Specified by:
      setThenStatement in interface CtIf
    • clone

      public CtIf clone()
      Description copied from interface: CtElement
      Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methods Refactoring.copyType(CtType) and Refactoring.copyMethod(CtMethod) instead which does additional work beyond cloning.
      Specified by:
      clone in interface CtCodeElement
      Specified by:
      clone in interface CtElement
      Specified by:
      clone in interface CtIf
      Specified by:
      clone in interface CtStatement
      Overrides:
      clone in class CtStatementImpl
    • S

      public Void S()
      Description copied from interface: TemplateParameter
      Gets the type of the template parameter. This methods has no runtime meaning (should return a null reference) but is used as a marker in a template code.
      Specified by:
      S in interface TemplateParameter<Void>
    • getSubstitution

      public CtCodeElement getSubstitution(CtType<?> targetType)