Class WrapIdentifierImpl<T>


public class WrapIdentifierImpl<T> extends WrapIdentifier<T>
A wrap identifier transformation with a fixed wrapping result.
See Also:
  • Constructor Details

    • WrapIdentifierImpl

      public WrapIdentifierImpl(String wrapResult, TransformationPhase<T> wrappingReplacer, TransformationPhase<T> wrappingInjector)
      Creates a new wrap identifier transformation with a fixed result identifier.
      Parameters:
      wrapResult - The identifier that's inserted for the wrapping
      wrappingReplacer - The replacer phase that replaces a target identifier with a replacement expression or identifier
      wrappingInjector - A transformation phase that does the additional code injection, usually providing a definition for the newly inserted identifier in the form of an external declaration of some sort
      See Also:
    • WrapIdentifierImpl

      public WrapIdentifierImpl(String wrapResult, HandlerTarget<T> wrappingTarget, TransformationPhase<T> wrappingInjector)
      Creates a new wrap identifier transformation with a fixed result identifier and a fixed replacement phase for which only the target is given.
      Parameters:
      wrapResult - The identifier that's inserted for the wrapping
      wrappingTarget - A replacement target to be used in a search terminals phase
      wrappingInjector - A transformation phase that does the additional code injection, usually providing a definition for the newly inserted identifier in the form of an external declaration of some sort
  • Method Details

    • getWrapResult

      public String getWrapResult()
      Description copied from class: WrapIdentifier
      Returns the wrap result that will be preset after wrapping. This is only used for detection of the identifier prior to wrapping for throwing an error if it's present.
      Specified by:
      getWrapResult in class WrapIdentifier<T>
      Returns:
      The identifier that's inserted for the wrapping
    • fromTerminal

      public static <T> WrapIdentifier<T> fromTerminal(String wrapTarget, String wrapResult, RunPhase<T> wrappingInjector)
      Creates a new wrap identifier transformation that uses an unparsed terminal replace target. It uses the wrap result as the identifier to disallow as well as the terminal to insert as a replacement. This is a commonly used operation when the inserted replacement is just a different identifier.
      Type Parameters:
      T - The job parameter type
      Parameters:
      wrapTarget - The identifier to replace
      wrapResult - The identifier that will be used to replace it
      wrappingInjector - A transformation phase that does the additional code injection
      Returns:
      The wrap identifier transformation with the given parameters
    • fromExpression

      public static <T> WrapIdentifier<T> fromExpression(String wrapTarget, String wrapResult, String wrapExpression, RunPhase<T> wrappingInjector)
      Creates a new wrap identifier transformation that uses a parsed replace target that replaces identifiers with an expression. (which may also just be an identifier)
      Type Parameters:
      T - The job parameter type
      Parameters:
      wrapTarget - The identifier to replace
      wrapResult - The identifier that will be used to replace it
      wrapExpression - The expression to insert instead of the wrapTarget
      wrappingInjector - A transformation phase that does the additional code injection
      Returns:
      The wrap identifier transformation with the given parameters
    • withExternalDeclaration

      public static <T> WrapIdentifier<T> withExternalDeclaration(String wrapTarget, String wrapResult, String wrapExpression, TransformationPhase.InjectionPoint location, String injectedCode)
      Creates a new wrap identifier transformation that inserts a parsed expression as a replacement and inserts a new external declaration.
      Type Parameters:
      T - The job parameter type
      Parameters:
      wrapTarget - The identifier to replace
      wrapResult - The identifier that will be used to replace it
      wrapExpression - The expression to insert instead of the wrapTarget
      location - The injection location for the new code
      injectedCode - The code to parse and inject as an external declaration at the given location
      Returns:
      The wrap identifier transformation with the given parameters
      See Also: