Package com.diffplug.spotless
Interface NoLambda
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
FormatExceptionPolicy
,LineEnding.Policy
,SerializableFileFilter
- All Known Implementing Classes:
FormatExceptionPolicyStrict
,FormatterStep.Strict
,LazyForwardingEquality
,NoLambda.EqualityBasedOnSerialization
public interface NoLambda extends Serializable
Marker interface to prevent lambda implementations of single-method interfaces that require serializability. In order for Spotless to support up-to-date checks, all of its parameters must beSerializable
so that entries can be written to file, and they must implement equals and hashCode correctly. This interface and its standard implementation,NoLambda.EqualityBasedOnSerialization
, are a quick way to accomplish these goals.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
NoLambda.EqualityBasedOnSerialization
An implementation of NoLambda in which equality is based on the serialized representation of itself.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
toBytes()
Returns a byte array representation of everything inside thisSerializableFileFilter
.
-
-
-
Method Detail
-
toBytes
byte[] toBytes()
Returns a byte array representation of everything inside thisSerializableFileFilter
. The main purpose of this method is to ensure one can't instantiate this class with lambda expressions, which are notoriously difficult to serialize and deserialize properly. (SeeSerializableFileFilterImpl.SkipFilesNamed
for an example of how to make a serializable subclass.)
-
-