Package com.diffplug.spotless
Class FormatterStep.Strict<State extends java.io.Serializable>
- java.lang.Object
-
- com.diffplug.spotless.LazyForwardingEquality<State>
-
- com.diffplug.spotless.FormatterStep.Strict<State>
-
- All Implemented Interfaces:
FormatterStep
,NoLambda
,java.io.Serializable
- Enclosing interface:
- FormatterStep
public abstract static class FormatterStep.Strict<State extends java.io.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.diffplug.spotless.FormatterStep
FormatterStep.Strict<State extends java.io.Serializable>
-
Nested classes/interfaces inherited from interface com.diffplug.spotless.NoLambda
NoLambda.EqualityBasedOnSerialization
-
-
Constructor Summary
Constructors Constructor Description Strict()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
format(java.lang.String rawUnix, java.io.File file)
Returns a formatted version of the given content.protected abstract java.lang.String
format(State state, java.lang.String rawUnix, java.io.File file)
Implements the formatting function strictly in terms of the input data and the result ofLazyForwardingEquality.calculateState()
.-
Methods inherited from class com.diffplug.spotless.LazyForwardingEquality
calculateState, equals, hashCode, state, toBytes, unlazy
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.diffplug.spotless.FormatterStep
filterByContentPattern, filterByFile, getName
-
-
-
-
Method Detail
-
format
protected abstract java.lang.String format(State state, java.lang.String rawUnix, java.io.File file) throws java.lang.Exception
Implements the formatting function strictly in terms of the input data and the result ofLazyForwardingEquality.calculateState()
.- Throws:
java.lang.Exception
-
format
public final java.lang.String format(java.lang.String rawUnix, java.io.File file) throws java.lang.Exception
Description copied from interface:FormatterStep
Returns a formatted version of the given content.- Specified by:
format
in interfaceFormatterStep
- Parameters:
rawUnix
- the content to format, guaranteed to have unix-style newlines ('\n'); never nullfile
- the file whichrawUnix
was obtained from; never null. Pass the referenceFormatter.NO_FILE_SENTINEL
if and only if no file is actually associated withrawUnix
- 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:
java.lang.Exception
- if the formatter step experiences a problem
-
-