类 JavaInput


public final class JavaInput extends Input
JavaInput extends Input to represent a Java input document.
  • 构造器详细资料

    • JavaInput

      public JavaInput(String text) throws com.palantir.javaformat.java.FormatterException
      Input constructor.
      参数:
      text - the input text
      抛出:
      com.palantir.javaformat.java.FormatterException - if the input cannot be parsed
  • 方法详细资料

    • getText

      public String getText()
      Get the input text.
      指定者:
      getText 在类中 Input
      返回:
      the input text
    • getPositionToColumnMap

      public com.google.common.collect.ImmutableMap<Integer,Integer> getPositionToColumnMap()
      指定者:
      getPositionToColumnMap 在类中 Input
    • getLineSeparator

      public String getLineSeparator()
    • getTokens

      public com.google.common.collect.ImmutableList<? extends Input.Token> getTokens()
      Get the input tokens.
      指定者:
      getTokens 在类中 Input
      返回:
      the input tokens
    • getPositionTokenMap

      public com.google.common.collect.ImmutableRangeMap<Integer,com.palantir.javaformat.java.JavaInput.Token> getPositionTokenMap()
      Get the navigable map from position to JavaInput.Token. Used to look for tokens following a given one, and to implement the --offset and --length flags to reformat a character range in the input file.
      指定者:
      getPositionTokenMap 在类中 Input
      返回:
      the navigable map from position to JavaInput.Token
    • toString

      public String toString()
      覆盖:
      toString 在类中 Input
    • getLineNumber

      public int getLineNumber(int inputPosition)
      从类复制的说明: Input
      Converts a character offset in the input to a line number.
      指定者:
      getLineNumber 在类中 Input
    • getColumnNumber

      public int getColumnNumber(int inputPosition)
      从类复制的说明: Input
      Converts a character offset in the input to a 0-based column number.
      指定者:
      getColumnNumber 在类中 Input
    • setCompilationUnit

      public void setCompilationUnit(com.sun.tools.javac.tree.JCTree.JCCompilationUnit unit)
    • characterRangesToTokenRanges

      public com.google.common.collect.RangeSet<Integer> characterRangesToTokenRanges(Collection<com.google.common.collect.Range<Integer>> characterRanges) throws com.palantir.javaformat.java.FormatterException
      抛出:
      com.palantir.javaformat.java.FormatterException