Package com.diffplug.spotless
Interface NoLambda
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
LineEnding.Policy,SerializableFileFilter
- All Known Implementing Classes:
LazyForwardingEquality,NoLambda.EqualityBasedOnSerialization
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 be Serializable 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 ClassesModifier and TypeInterfaceDescriptionstatic classAn implementation of NoLambda in which equality is based on the serialized representation of itself. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]toBytes()Returns a byte array representation of everything inside thisSerializableFileFilter.
-
Method Details
-
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. (See
SerializableFileFilterImpl.SkipFilesNamedfor an example of how to make a serializable subclass.)
-