Class ModifierOrderer


  • final class ModifierOrderer
    extends java.lang.Object
    Fixes sequences of modifiers to be in JLS order.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  ModifierOrderer.ModifierTokens
      A 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 void addTrivia​(java.lang.StringBuilder replacement, com.google.common.collect.ImmutableList<? extends Input.Tok> toks)  
      private static JavaInput applyReplacements​(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.Modifier asModifier​(com.google.common.collect.ImmutableList<Input.Token> tokens)  
      private static @Nullable javax.lang.model.element.Modifier asModifier​(Input.Token token)
      Returns the given token as a Modifier, or null if it is not a modifier.
      private static @Nullable ModifierOrderer.ModifierTokens getModifierTokens​(java.util.Iterator<? extends Input.Token> it)  
      (package private) static JavaInput reorderModifiers​(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 JavaInput reorderModifiers​(java.lang.String text)
      Reorders all modifiers in the given text to be in JLS order.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModifierOrderer

        ModifierOrderer()
    • Method Detail

      • 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)
      • 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 a Modifier, or null if 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