Record Class JavaFormatterOptions

java.lang.Object
java.lang.Record
com.google.googlejavaformat.java.JavaFormatterOptions
Record Components:
style - Returns the code style.

@Immutable public record JavaFormatterOptions(boolean formatJavadoc, boolean reorderModifiers, JavaFormatterOptions.Style style) extends Record
Options for a google-java-format invocation.

Like gofmt, the google-java-format CLI exposes no configuration options (aside from --aosp).

The goal of google-java-format is to provide consistent formatting, and to free developers from arguments over style choices. It is an explicit non-goal to support developers' individual preferences, and in fact it would work directly against our primary goals.

  • Constructor Details

    • JavaFormatterOptions

      public JavaFormatterOptions(boolean formatJavadoc, boolean reorderModifiers, JavaFormatterOptions.Style style)
      Creates an instance of a JavaFormatterOptions record class.
      Parameters:
      formatJavadoc - the value for the formatJavadoc record component
      reorderModifiers - the value for the reorderModifiers record component
      style - the value for the style record component
  • Method Details

    • indentationMultiplier

      public int indentationMultiplier()
      Returns the multiplier for the unit of indent.
    • defaultOptions

      public static JavaFormatterOptions defaultOptions()
      Returns the default formatting options.
    • builder

      public static JavaFormatterOptions.Builder builder()
      Returns a builder for JavaFormatterOptions.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • formatJavadoc

      public boolean formatJavadoc()
      Returns the value of the formatJavadoc record component.
      Returns:
      the value of the formatJavadoc record component
    • reorderModifiers

      public boolean reorderModifiers()
      Returns the value of the reorderModifiers record component.
      Returns:
      the value of the reorderModifiers record component
    • style

      Returns the value of the style record component.
      Returns:
      the value of the style record component