Class StatementTemplate

All Implemented Interfaces:
Template<CtStatement>

public abstract class StatementTemplate extends AbstractTemplate<CtStatement>
This class represents a template parameter that defines a statement list directly expressed in Java (no returns).

To define a new statement list template parameter, you must subclass this class and implement the statement() method, which actually defines the Java statements. It corresponds to a CtStatementList.

  • Constructor Details

    • StatementTemplate

      public StatementTemplate()
      Creates a new statement list template parameter.
  • Method Details

    • apply

      public CtStatement apply(CtType<?> targetType)
      Description copied from interface: Template
      Returns the code which results from applying the template.
      Parameters:
      targetType - the type that defines the context of the substitution. It may be null for templates with no context.
    • S

      public Void S()
    • statement

      public abstract void statement() throws Throwable
      This method must be implemented to define the template statement list.
      Throws:
      Throwable