public final class ApplySuggestedFixes
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String>> |
applyAllSuggestedFixChoicesToCode(java.lang.Iterable<SuggestedFix> fixChoices,
java.util.Map<java.lang.String,java.lang.String> fileNameToCodeMap)
Applies all possible options from each
SuggestedFixAlternative to the provided code and
returns the new code. |
static java.lang.String |
applyCodeReplacements(java.lang.Iterable<CodeReplacement> replacements,
java.lang.String code)
Applies the provided set of code replacements to the code and returns the transformed code.
|
static com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> |
applySuggestedFixesToCode(java.lang.Iterable<SuggestedFix> fixes,
java.util.Map<java.lang.String,java.lang.String> filenameToCodeMap)
Applies the provided set of suggested fixes to the provided code and returns the new code,
ignoring alternative fixes.
|
static void |
applySuggestedFixesToFiles(java.lang.Iterable<SuggestedFix> fixes)
Applies the provided set of suggested fixes to the files listed in the suggested fixes.
|
public static void applySuggestedFixesToFiles(java.lang.Iterable<SuggestedFix> fixes) throws java.io.IOException
java.io.IOException
public static com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String>> applyAllSuggestedFixChoicesToCode(java.lang.Iterable<SuggestedFix> fixChoices, java.util.Map<java.lang.String,java.lang.String> fileNameToCodeMap)
SuggestedFixAlternative
to the provided code and
returns the new code. This only makes sense if all the SuggestedFixAlternatives come from the
same checker, i.e. they offer the same number of choices and the same index corresponds to
similar fixes. The filenameToCodeMap
must contain all the files that the provided fixes
apply to. The fixes can be provided in any order, but they may not have any overlapping
modifications for the same file. This function will return new code only for the files that
have been modified.public static com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> applySuggestedFixesToCode(java.lang.Iterable<SuggestedFix> fixes, java.util.Map<java.lang.String,java.lang.String> filenameToCodeMap)
filenameToCodeMap
must contain all the files that the
provided fixes apply to. The fixes can be provided in any order, but they may not have any
overlapping modifications for the same file. This function will return new code only for the
files that have been modified.public static java.lang.String applyCodeReplacements(java.lang.Iterable<CodeReplacement> replacements, java.lang.String code)
Copyright © 2009-2019 Google. All Rights Reserved.