Package com.diffplug.gradle.spotless
Class JavaExtension
java.lang.Object
com.diffplug.gradle.spotless.FormatExtension
com.diffplug.gradle.spotless.JavaExtension
- All Implemented Interfaces:
HasBuiltinDelimiterForLicense
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
class
class
class
class
class
Nested classes/interfaces inherited from class com.diffplug.gradle.spotless.FormatExtension
FormatExtension.BiomeGeneric, FormatExtension.ClangFormatConfig, FormatExtension.EclipseWtpConfig, FormatExtension.IdeaConfig, FormatExtension.LicenseHeaderConfig, FormatExtension.NpmStepConfig<T extends FormatExtension.NpmStepConfig<?>>, FormatExtension.PrettierConfig
-
Field Summary
Fields inherited from class com.diffplug.gradle.spotless.FormatExtension
steps, target, targetExclude, targetExcludeContentPattern
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApply CleanThat refactoring rules.eclipse()
void
Removes newlines between type annotations and types.default FileCollection
getSources
(Project project, String message, Function<SourceSet, SourceDirectorySet> sourceSetSourceDirectory, Spec<? super File> filterSpec) Uses the google-java-format jar to format source code.googleJavaFormat
(String version) Uses the given version of google-java-format to format source code.importOrder
(String... importOrder) importOrderFile
(Object importOrderFile) licenseHeader
(String licenseHeader) licenseHeaderFile
(Object licenseHeaderFile) Uses the palantir-java-format jar to format source code.palantirJavaFormat
(String version) Uses the given version of palantir-java-format to format source code.void
Removes any unused imports.void
removeUnusedImports
(String formatter) void
Deprecated.protected void
setupTask
(SpotlessTask task) If the user hasn't specified the files yet, we'll assume he/she means all of the java files.Methods inherited from class com.diffplug.gradle.spotless.FormatExtension
addStep, addStep, biome, biome, bumpThisNumberIfACustomStepChanges, clangFormat, clangFormat, clearSteps, createIndependentApplyTask, createIndependentApplyTaskLazy, custom, custom, eclipseWtp, eclipseWtp, encoding, endWithNewline, forbidRegex, getEncoding, getExistingStepIdx, getLineEndings, getProject, getRatchetFrom, idea, ignoreErrorForPath, ignoreErrorForStep, indentWithSpaces, indentWithSpaces, indentWithTabs, indentWithTabs, isLicenseHeaderStep, leadingSpacesToTabs, leadingSpacesToTabs, leadingTabsToSpaces, leadingTabsToSpaces, licenseHeader, licenseHeaderFile, nativeCmd, noDefaultTargetException, parseTarget, prettier, prettier, prettier, provisioner, ratchetFrom, replace, replaceRegex, replaceStep, setEncoding, setEncoding, setLineEndings, setRatchetFrom, suppressLintsFor, target, targetExclude, targetExcludeIfContentContains, targetExcludeIfContentContainsRegex, toggleOffOn, toggleOffOn, toggleOffOnDisable, toggleOffOnRegex, trimTrailingWhitespace, withinBlocks, withinBlocks, withinBlocksRegex, withinBlocksRegex
-
Constructor Details
-
JavaExtension
-
-
Method Details
-
licenseHeader
- Specified by:
licenseHeader
in interfaceHasBuiltinDelimiterForLicense
- Parameters:
licenseHeader
- Content that should be at the top of every file.
-
licenseHeaderFile
- Specified by:
licenseHeaderFile
in interfaceHasBuiltinDelimiterForLicense
- Parameters:
licenseHeaderFile
- Content that should be at the top of every file.
-
importOrder
-
importOrderFile
-
removeUnusedImports
public void removeUnusedImports()Removes any unused imports. -
removeUnusedImports
-
removeWildcardImports
Deprecated. -
forbidWildcardImports
public void forbidWildcardImports() -
googleJavaFormat
Uses the google-java-format jar to format source code. -
googleJavaFormat
Uses the given version of google-java-format to format source code.Limited to published versions. See issue #33 for a workaround for using snapshot versions.
-
palantirJavaFormat
Uses the palantir-java-format jar to format source code. -
palantirJavaFormat
Uses the given version of palantir-java-format to format source code.Limited to published versions. See issue #33 for a workaround for using snapshot versions.
-
eclipse
-
eclipse
-
formatAnnotations
Removes newlines between type annotations and types. -
cleanthat
Apply CleanThat refactoring rules. -
setupTask
If the user hasn't specified the files yet, we'll assume he/she means all of the java files.- Overrides:
setupTask
in classFormatExtension
-
getSources
default FileCollection getSources(Project project, String message, Function<SourceSet, SourceDirectorySet> sourceSetSourceDirectory, Spec<? super File> filterSpec)
-