Package com.diffplug.gradle.spotless
Class JavaExtension
- java.lang.Object
-
- com.diffplug.gradle.spotless.FormatExtension
-
- com.diffplug.gradle.spotless.JavaExtension
-
- All Implemented Interfaces:
HasBuiltinDelimiterForLicense
public class JavaExtension extends FormatExtension implements HasBuiltinDelimiterForLicense
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classJavaExtension.EclipseConfigclassJavaExtension.GoogleJavaFormatConfigclassJavaExtension.ImportOrderConfigclassJavaExtension.PalantirJavaFormatConfig-
Nested classes/interfaces inherited from class com.diffplug.gradle.spotless.FormatExtension
FormatExtension.ClangFormatConfig, FormatExtension.EclipseWtpConfig, FormatExtension.LicenseHeaderConfig, FormatExtension.NpmStepConfig<T extends FormatExtension.NpmStepConfig<?>>, FormatExtension.PrettierConfig
-
-
Field Summary
-
Fields inherited from class com.diffplug.gradle.spotless.FormatExtension
steps, target, targetExclude
-
-
Constructor Summary
Constructors Constructor Description JavaExtension(SpotlessExtension spotless)
-
Method Summary
-
Methods inherited from class com.diffplug.gradle.spotless.FormatExtension
addStep, bumpThisNumberIfACustomStepChanges, clangFormat, clangFormat, clearSteps, createIndependentApplyTask, custom, custom, eclipseWtp, eclipseWtp, encoding, endWithNewline, getEncoding, getExistingStepIdx, getLineEndings, getProject, getRatchetFrom, ignoreErrorForPath, ignoreErrorForStep, indentWithSpaces, indentWithSpaces, indentWithTabs, indentWithTabs, isLicenseHeaderStep, licenseHeader, licenseHeaderFile, nativeCmd, noDefaultTargetException, parseTarget, prettier, prettier, prettier, provisioner, ratchetFrom, replace, replaceRegex, replaceStep, setEncoding, setEncoding, setLineEndings, setRatchetFrom, target, targetExclude, toggleOffOn, toggleOffOn, toggleOffOnDisable, toggleOffOnRegex, trimTrailingWhitespace, withinBlocks, withinBlocks, withinBlocksRegex, withinBlocksRegex
-
-
-
-
Constructor Detail
-
JavaExtension
@Inject public JavaExtension(SpotlessExtension spotless)
-
-
Method Detail
-
licenseHeader
public FormatExtension.LicenseHeaderConfig licenseHeader(String licenseHeader)
- Specified by:
licenseHeaderin interfaceHasBuiltinDelimiterForLicense- Parameters:
licenseHeader- Content that should be at the top of every file.
-
licenseHeaderFile
public FormatExtension.LicenseHeaderConfig licenseHeaderFile(Object licenseHeaderFile)
- Specified by:
licenseHeaderFilein interfaceHasBuiltinDelimiterForLicense- Parameters:
licenseHeaderFile- Content that should be at the top of every file.
-
importOrder
public JavaExtension.ImportOrderConfig importOrder(String... importOrder)
-
importOrderFile
public JavaExtension.ImportOrderConfig importOrderFile(Object importOrderFile)
-
removeUnusedImports
public void removeUnusedImports()
Removes any unused imports.
-
googleJavaFormat
public JavaExtension.GoogleJavaFormatConfig googleJavaFormat()
Uses the google-java-format jar to format source code.
-
googleJavaFormat
public JavaExtension.GoogleJavaFormatConfig googleJavaFormat(String version)
Uses the given version of google-java-format to format source code. Limited to published versions. See issue #33 for an workaround for using snapshot versions.
-
palantirJavaFormat
public JavaExtension.PalantirJavaFormatConfig palantirJavaFormat()
Uses the palantir-java-format jar to format source code.
-
palantirJavaFormat
public JavaExtension.PalantirJavaFormatConfig palantirJavaFormat(String version)
Uses the given version of palantir-java-format to format source code. Limited to published versions. See issue #33 for an workaround for using snapshot versions.
-
eclipse
public JavaExtension.EclipseConfig eclipse()
-
eclipse
public JavaExtension.EclipseConfig eclipse(String version)
-
setupTask
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.- Overrides:
setupTaskin classFormatExtension
-
-