Class FormatterStep.Strict<State extends Serializable>

  • All Implemented Interfaces:
    FormatterStep, NoLambda, Serializable
    Enclosing interface:
    FormatterStep

    public abstract static class FormatterStep.Strict<State extends Serializable>
    extends LazyForwardingEquality<State>
    implements FormatterStep
    Implements a FormatterStep in a strict way which guarantees correct and lazy implementation of up-to-date checks. This maximizes performance for cases where the FormatterStep is not actually needed (e.g. don't load eclipse setting file unless this step is actually running) while also ensuring that gradle can detect changes in a step's settings to determine that it needs to rerun a format.
    See Also:
    Serialized Form
    • Constructor Detail

      • Strict

        public Strict()
    • Method Detail

      • format

        public final String format​(String rawUnix,
                                   File file)
                            throws Exception
        Description copied from interface: FormatterStep
        Returns a formatted version of the given content.
        Specified by:
        format in interface FormatterStep
        Parameters:
        rawUnix - the content to format, guaranteed to have unix-style newlines ('\n'); never null
        file - the file which rawUnix was obtained from; never null. Pass an empty file using new File("") if and only if no file is actually associated with rawUnix
        Returns:
        the formatted content, guaranteed to only have unix-style newlines; may return null if the formatter step doesn't have any changes to make
        Throws:
        Exception - if the formatter step experiences a problem