Package com.google.googlejavaformat.java
Class ModifierOrderer
- java.lang.Object
-
- com.google.googlejavaformat.java.ModifierOrderer
-
final class ModifierOrderer extends java.lang.ObjectFixes sequences of modifiers to be in JLS order.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classModifierOrderer.ModifierTokensA class that contains the tokens corresponding to a modifier.
-
Constructor Summary
Constructors Constructor Description ModifierOrderer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidaddTrivia(java.lang.StringBuilder replacement, com.google.common.collect.ImmutableList<? extends Input.Tok> toks)private static JavaInputapplyReplacements(JavaInput javaInput, com.google.common.collect.TreeRangeMap<java.lang.Integer,java.lang.String> replacementMap)Applies replacements to the given string.private static @Nullable javax.lang.model.element.ModifierasModifier(com.google.common.collect.ImmutableList<Input.Token> tokens)private static @Nullable javax.lang.model.element.ModifierasModifier(Input.Token token)Returns the given token as aModifier, ornullif it is not a modifier.private static @Nullable ModifierOrderer.ModifierTokensgetModifierTokens(java.util.Iterator<? extends Input.Token> it)(package private) static JavaInputreorderModifiers(JavaInput javaInput, java.util.Collection<com.google.common.collect.Range<java.lang.Integer>> characterRanges)Reorders all modifiers in the given text and within the given character ranges to be in JLS order.(package private) static JavaInputreorderModifiers(java.lang.String text)Reorders all modifiers in the given text to be in JLS order.
-
-
-
Method Detail
-
reorderModifiers
static JavaInput reorderModifiers(java.lang.String text) throws FormatterException
Reorders all modifiers in the given text to be in JLS order.- Throws:
FormatterException
-
reorderModifiers
static JavaInput reorderModifiers(JavaInput javaInput, java.util.Collection<com.google.common.collect.Range<java.lang.Integer>> characterRanges) throws FormatterException
Reorders all modifiers in the given text and within the given character ranges to be in JLS order.- Throws:
FormatterException
-
addTrivia
private static void addTrivia(java.lang.StringBuilder replacement, com.google.common.collect.ImmutableList<? extends Input.Tok> toks)
-
getModifierTokens
private static @Nullable ModifierOrderer.ModifierTokens getModifierTokens(java.util.Iterator<? extends Input.Token> it)
-
asModifier
private static @Nullable javax.lang.model.element.Modifier asModifier(com.google.common.collect.ImmutableList<Input.Token> tokens)
-
asModifier
private static @Nullable javax.lang.model.element.Modifier asModifier(Input.Token token)
Returns the given token as aModifier, ornullif it is not a modifier.
-
applyReplacements
private static JavaInput applyReplacements(JavaInput javaInput, com.google.common.collect.TreeRangeMap<java.lang.Integer,java.lang.String> replacementMap) throws FormatterException
Applies replacements to the given string.- Throws:
FormatterException
-
-