Class SuggestedFix

All Implemented Interfaces:

public abstract class SuggestedFix extends Object implements Fix
Author: (Alex Eagle)
  • Constructor Details

    • SuggestedFix

      public SuggestedFix()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Fix
    • getImportsToAdd

      public abstract<String> getImportsToAdd()
      Specified by:
      getImportsToAdd in interface Fix
    • getImportsToRemove

      public abstract<String> getImportsToRemove()
      Specified by:
      getImportsToRemove in interface Fix
    • toString

      public String toString( compilationUnit)
      Specified by:
      toString in interface Fix
    • getShortDescription

      public abstract String getShortDescription()
      Description copied from interface: Fix
      A short description which can be attached to the Fix to differentiate multiple fixes provided to the user.

      Empty string generates the default description.

      Specified by:
      getShortDescription in interface Fix
    • hashCode

      @Memoized public abstract int hashCode()
      hashCode in class Object
    • getReplacements

      public<Replacement> getReplacements( endPositions)
      Specified by:
      getReplacements in interface Fix
    • replace

      public static SuggestedFix replace(com.sun.source.tree.Tree tree, String replaceWith)
    • replace

      public static SuggestedFix replace(int startPos, int endPos, String replaceWith)
      Replace the characters from startPos, inclusive, until endPos, exclusive, with the given string.
      startPos - The position from which to start replacing, inclusive
      endPos - The position at which to end replacing, exclusive
      replaceWith - The string to replace with
    • replace

      public static SuggestedFix replace(com.sun.source.tree.Tree node, String replaceWith, int startPosAdjustment, int endPosAdjustment)
      Replace a tree node with a string, but adjust the start and end positions as well. For example, if the tree node begins at index 10 and ends at index 30, this call will replace the characters at index 15 through 25 with "replacement":
       fix.replace(node, "replacement", 5, -5)
      node - The tree node to replace
      replaceWith - The string to replace with
      startPosAdjustment - The adjustment to add to the start position (negative is OK)
      endPosAdjustment - The adjustment to add to the end position (negative is OK)
    • prefixWith

      public static SuggestedFix prefixWith(com.sun.source.tree.Tree node, String prefix)
    • postfixWith

      public static SuggestedFix postfixWith(com.sun.source.tree.Tree node, String postfix)
    • delete

      public static SuggestedFix delete(com.sun.source.tree.Tree node)
    • swap

      public static SuggestedFix swap(com.sun.source.tree.Tree node1, com.sun.source.tree.Tree node2)
    • emptyFix

      public static SuggestedFix emptyFix()
      Creates an empty SuggestedFix.
    • merge

      public static SuggestedFix merge(SuggestedFix first, SuggestedFix second, SuggestedFix... more)
    • builder

      public static SuggestedFix.Builder builder()
    • toBuilder

      public SuggestedFix.Builder toBuilder()