Class BlockTemplate

java.lang.Object
spoon.template.AbstractTemplate<CtBlock<?>>
spoon.template.BlockTemplate
All Implemented Interfaces:
Template<CtBlock<?>>

public abstract class BlockTemplate extends AbstractTemplate<CtBlock<?>>
This class represents a template parameter that defines a void block statement directly expressed in Java (no returns).

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

  • Constructor Details

    • BlockTemplate

      public BlockTemplate()
      Creates a new block template parameter.
  • Method Details

    • getBlock

      public static CtBlock<?> getBlock(CtClass<? extends BlockTemplate> p)
      Returns the block.
    • apply

      public CtBlock<?> 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()
    • block

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