public class JavaExtension extends FormatExtension implements HasBuiltinDelimiterForLicense
Modifier and Type | Class and Description |
---|---|
class |
JavaExtension.EclipseConfig |
class |
JavaExtension.GoogleJavaFormatConfig |
FormatExtension.ClangFormatConfig, FormatExtension.EclipseWtpConfig, FormatExtension.LicenseHeaderConfig, FormatExtension.NpmStepConfig<T extends FormatExtension.NpmStepConfig<?>>, FormatExtension.PrettierConfig
steps, target, targetExclude
Constructor and Description |
---|
JavaExtension(SpotlessExtension spotless) |
Modifier and Type | Method and Description |
---|---|
JavaExtension.EclipseConfig |
eclipse() |
JavaExtension.EclipseConfig |
eclipse(String version) |
JavaExtension.GoogleJavaFormatConfig |
googleJavaFormat()
Uses the google-java-format jar to format source code.
|
JavaExtension.GoogleJavaFormatConfig |
googleJavaFormat(String version)
Uses the given version of google-java-format to format source code.
|
void |
importOrder(String... importOrder) |
void |
importOrderFile(Object importOrderFile) |
FormatExtension.LicenseHeaderConfig |
licenseHeader(String licenseHeader) |
FormatExtension.LicenseHeaderConfig |
licenseHeaderFile(Object licenseHeaderFile) |
void |
removeUnusedImports()
Removes any unused imports.
|
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.
|
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
public JavaExtension(SpotlessExtension spotless)
public FormatExtension.LicenseHeaderConfig licenseHeader(String licenseHeader)
licenseHeader
in interface HasBuiltinDelimiterForLicense
licenseHeader
- Content that should be at the top of every file.public FormatExtension.LicenseHeaderConfig licenseHeaderFile(Object licenseHeaderFile)
licenseHeaderFile
in interface HasBuiltinDelimiterForLicense
licenseHeaderFile
- Content that should be at the top of every file.public void importOrder(String... importOrder)
public void importOrderFile(Object importOrderFile)
public void removeUnusedImports()
Removes any unused imports.
public JavaExtension.GoogleJavaFormatConfig googleJavaFormat()
Uses the google-java-format jar to format source code.
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.
public JavaExtension.EclipseConfig eclipse()
public JavaExtension.EclipseConfig eclipse(String version)
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.
setupTask
in class FormatExtension