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.GoogleJavaFormatConfig-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaExtension.EclipseConfigeclipse()JavaExtension.EclipseConfigeclipse(String version)JavaExtension.GoogleJavaFormatConfiggoogleJavaFormat()Uses the google-java-format jar to format source code.JavaExtension.GoogleJavaFormatConfiggoogleJavaFormat(String version)Uses the given version of google-java-format to format source code.voidimportOrder(String... importOrder)voidimportOrderFile(Object importOrderFile)FormatExtension.LicenseHeaderConfiglicenseHeader(String licenseHeader)FormatExtension.LicenseHeaderConfiglicenseHeaderFile(Object licenseHeaderFile)voidremoveUnusedImports()Removes any unused imports.protected voidsetupTask(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, bumpThisNumberIfACustomStepChanges, clangFormat, clangFormat, clearSteps, createIndependentApplyTask, custom, custom, eclipseWtp, eclipseWtp, encoding, endWithNewline, getEncoding, getExistingStepIdx, getLineEndings, getProject, getRatchetFrom, ignoreErrorForPath, ignoreErrorForStep, indentWithSpaces, indentWithSpaces, indentWithTabs, indentWithTabs, licenseHeader, licenseHeaderFile, 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 void importOrder(String... importOrder)
-
importOrderFile
public void 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.
-
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
-
-