Package com.diffplug.spotless
Interface FormatterFunc
- All Known Subinterfaces:
FormatterFunc.Closeable
,FormatterFunc.NeedsFile
- All Known Implementing Classes:
RdfFormatterFunc
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A
Function<String, String>
which can throw an exception. Technically, there
is also a File
argument which gets passed around as well, but that is invisible
to formatters. If you need the File, see FormatterFunc.NeedsFile
.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Function<String, String>
andBiFunction<String, File, String>
whose implementation requires a resource which should be released when the function is no longer needed.static interface
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
Calculates a list of lints against the given content.static FormatterFunc
needsFile
(FormatterFunc.NeedsFile needsFile) Ideally, formatters don't need the underlying file.
-
Method Details
-
apply
- Throws:
Exception
-
apply
- Throws:
Exception
-
lint
Calculates a list of lints against the given content. By default, that's just an throwables thrown by the lint.- Throws:
Exception
-
needsFile
Ideally, formatters don't need the underlying file. But in case they do, they should only use it's path, and should never read the content inside the file, because that breaks theFunction<String, String>
composition that Spotless is based on. For the rare case that you need access to the file, use this method orFormatterFunc.NeedsFile
to create aFormatterFunc
which needs the File.
-