Package org.apache.maven.plugins.javadoc
Class AbstractFixJavadocMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.javadoc.AbstractFixJavadocMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
FixJavadocMojo,TestFixJavadocMojo
public abstract class AbstractFixJavadocMojo extends org.apache.maven.plugin.AbstractMojoAbstract class to fix Javadoc documentation and tags in source files.
See Where Tags Can Be Used.- Since:
- 2.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAbstractFixJavadocMojo.JavaEntityTagsWrapper class for the entity's tags.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringAUTHOR_TAGTag name for @author *private static java.lang.StringCLIRR_MAVEN_PLUGIN_ARTIFACTIDThe Clirr Maven plugin artifactIdclirr-maven-plugin*private static java.lang.StringCLIRR_MAVEN_PLUGIN_GOALThe Clirr Maven plugin goalcheck*private static java.lang.StringCLIRR_MAVEN_PLUGIN_GROUPIDThe Clirr Maven plugin groupIdorg.codehaus.mojo*private static java.lang.StringCLIRR_MAVEN_PLUGIN_VERSIONThe latest Clirr Maven plugin version2.2.2*private java.util.List<java.lang.String>clirrNewClassesNew classes found by Clirr.private java.util.Map<java.lang.String,java.util.List<java.lang.String>>clirrNewMethodsNew Methods in a Class (the key) found by Clirr.private java.lang.StringcomparisonVersionVersion to compare the current code against using the Clirr Maven Plugin.static java.lang.StringDEFAULT_VERSION_VALUEDefault version value.private java.lang.StringdefaultAuthorDefault value for the Javadoc tag@author.private java.lang.StringdefaultSinceDefault value for the Javadoc tag@since.private java.lang.StringdefaultVersionDefault value for the Javadoc tag@version.private java.lang.StringencodingThe file encoding to use when reading the source files.private static java.lang.StringEND_JAVADOCEnd Javadoc String i.e.private static java.lang.StringEOLThe vm line separatorprivate java.lang.StringexcludesComma separated excludes Java files, i.e.private static java.lang.StringFIX_TAGS_ALLallparameter used byfixTags*private booleanfixClassCommentFlag to fix the classes or interfaces Javadoc comments according thelevel.private booleanfixFieldCommentFlag to fix the fields Javadoc comments according thelevel.private booleanfixMethodCommentFlag to fix the methods Javadoc comments according thelevel.private java.lang.StringfixTagsComma separated tags to fix in classes, interfaces or methods Javadoc comments.private java.lang.String[]fixTagsSplittedSplitfixTagsby comma.private booleanforceForcing the goal execution i.e.protected booleanignoreClirrFlag to ignore or not Clirr.private java.lang.StringincludesComma separated includes Java files, i.e.private static java.lang.StringINHERITED_JAVADOCInherited Javadoc i.e.private static java.lang.StringINHERITED_TAGTag name for {@inheritDoc} *private org.codehaus.plexus.components.interactivity.InputHandlerinputHandlerInput handler, needed for command line handling.static java.lang.StringJAVA_FILESJava Files Pattern.private java.lang.StringlevelSpecifies the access level for classes and members to show in the Javadocs.private static java.lang.StringLEVEL_PACKAGEpackageparameter used bylevel*private static java.lang.StringLEVEL_PRIVATEprivateparameter used bylevel*private static java.lang.StringLEVEL_PROTECTEDprotectedparameter used bylevel*private static java.lang.StringLEVEL_PUBLICpublicparameter used bylevel*private static java.lang.StringLINK_TAGTag name for @link *private org.apache.maven.artifact.repository.ArtifactRepositorylocalRepositoryThe local repository where the artifacts are located, used by the tests.private java.io.FileoutputDirectoryOutput directory where Java classes will be rewritten.private static java.lang.StringPARAM_TAGTag name for @param *private org.apache.maven.project.MavenProjectprojectThe Maven Project Object.private java.lang.ClassLoaderprojectClassLoaderThe current project class loader.private booleanremoveUnknownThrowsFlag to remove throws tags from unknown classes.private static java.lang.StringRETURN_TAGTag name for @return *private static java.lang.StringSEPARATOR_JAVADOCJavadoc Separator i.e.private org.apache.maven.execution.MavenSessionsessionprivate org.apache.maven.settings.SettingssettingsThe current user system settings for use in Maven.private static java.lang.StringSINCE_TAGTag name for @since *private java.util.List<java.lang.String>sinceClassesList of classes where*sinceis added.private static java.lang.StringSTART_JAVADOCStart Javadoc String i.e.private static java.lang.StringTHROWS_TAGTag name for @throws *private static java.lang.StringVERSION_TAGTag name for @version *
-
Constructor Summary
Constructors Constructor Description AbstractFixJavadocMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddDefaultClassComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaClass javaClass, java.lang.String indent)Add a default Javadoc for the given class, i.e.:
1 /**
2 * {Comment based on the class name}
3 *
4 * @author X {added if addMissingAuthor}
5 * @version X {added if addMissingVersion}
6 * @since X {added if addMissingSince and new classes from previous version}
7 */
8 public class DummyClass {}private voidaddDefaultFieldComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaField field, java.lang.String indent)Add a default Javadoc for the given field, i.e.:
1 /** Constant <code> MY_STRING_CONSTANT="value" </code> */
2 public static final String MY_STRING_CONSTANT = "value";private voidaddDefaultJavadocComment(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable)private voidaddDefaultJavadocTags(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable)private voidaddDefaultMethodComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, java.lang.String indent)Add in the buffer a default Javadoc for the given class:
1 /**
2 * {Comment based on the method name}
3 *
4 * @param X {added if addMissingParam}
5 * @return X {added if addMissingReturn}
6 * @throws X {added if addMissingThrows}
7 * @since X {added if addMissingSince and new classes from previous version}
8 */
9 public void dummyMethod ( String s ){}private voidaddMissingJavadocTags(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags)Add missing tags not already written.private voidaddSinceClasses(com.thoughtworks.qdox.model.JavaClass javaClass)private static java.lang.StringalignIndentationJavadocLines(java.lang.String content, java.lang.String indent)private voidappendDefaultAuthorTag(java.lang.StringBuilder sb, java.lang.String indent)private booleanappendDefaultAuthorTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)private booleanappendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaParameter typeParam)private booleanappendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)private voidappendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaParameter typeParam)private voidappendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)private booleanappendDefaultReturnTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaMethod javaMethod)private voidappendDefaultReturnTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaMethod javaMethod)private voidappendDefaultSinceTag(java.lang.StringBuilder sb, java.lang.String indent)private booleanappendDefaultSinceTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)private booleanappendDefaultThrowsTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaType exception)private voidappendDefaultThrowsTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaType exception)private voidappendDefaultVersionTag(java.lang.StringBuilder sb, java.lang.String indent)private booleanappendDefaultVersionTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)private voidappendSeparator(java.lang.StringBuilder sb, java.lang.String indent)private static java.lang.StringautodetectIndentation(java.lang.String line)Autodetect the indentation of a given line:voidexecute()private voidexecuteClirr()Invoke Maven to run clirr-maven-plugin to find API differences.(package private) static java.lang.StringextractOriginalJavadoc(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity)Extract the original Javadoc and others comments up toSTART_JAVADOCform the entity.(package private) static java.lang.StringextractOriginalJavadocContent(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity)Extract the Javadoc comment betweenSTART_JAVADOCandEND_JAVADOCform the entity.private booleanfixClassComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaClass javaClass, java.lang.String indent)Add/update Javadoc class comment.private booleanfixFieldComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaClass javaClass, com.thoughtworks.qdox.model.JavaField field, java.lang.String indent)Add Javadoc field comment, only for static fields or interface fields.private booleanfixMethodComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, java.lang.String indent)Add/update Javadoc method comment.private booleanfixTag(java.lang.String tag)protected java.lang.StringgetArtifactType(org.apache.maven.project.MavenProject p)private java.lang.Class<?>getClass(com.thoughtworks.qdox.model.JavaClass currentClass, java.lang.String exceptionClassName)Returns the Class object assignable forRuntimeExceptionclass and associated with the given exception class name.private java.lang.Class<?>getClass(java.lang.String className)protected java.util.List<java.lang.String>getCompileClasspathElements(org.apache.maven.project.MavenProject p)private static java.lang.StringgetDefaultClassJavadocComment(com.thoughtworks.qdox.model.JavaClass javaClass)Default comment for class.private java.lang.StringgetDefaultJavadocForType(com.thoughtworks.qdox.model.JavaClass clazz)private java.lang.StringgetDefaultJavadocForType(com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)private static java.lang.StringgetDefaultMethodJavadocComment(com.thoughtworks.qdox.model.JavaExecutable javaExecutable)Default comment for method with taking care of getter/setter in the javaMethod name.private static java.lang.StringgetFullClirrGoal()(package private) static java.lang.StringgetJavadocComment(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity)Workaround for QDOX-146 about whitespace.(package private) java.lang.StringgetJavadocComment(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, com.thoughtworks.qdox.model.DocletTag docletTag)Work around for QDOX-146 about whitespace.protected static java.lang.StringgetJavaMethodAsString(com.thoughtworks.qdox.model.JavaExecutable javaExecutable)private static java.lang.String[]getLines(java.lang.String content)protected org.apache.maven.project.MavenProjectgetProject()private java.lang.ClassLoadergetProjectClassLoader()private java.io.FilegetProjectSourceDirectory()protected java.util.List<java.lang.String>getProjectSourceRoots(org.apache.maven.project.MavenProject p)private java.util.Collection<com.thoughtworks.qdox.model.JavaClass>getQdoxClasses()Calling Qdox to findJavaClassobjects from the Maven project sources.private static booleanhasInheritedTag(java.lang.String content)Try to find if a Javadoc comment has anINHERITED_TAGfor instance:private voidinit()Init goal parameters.private booleanisInherited(com.thoughtworks.qdox.model.JavaExecutable javaMethod)Verify if a method has@java.lang.Override()annotation or if it is an inherited method from an interface or a super class.private booleanisInherited(java.lang.Class<?> clazz, com.thoughtworks.qdox.model.JavaExecutable javaMethod)private booleanisInLevel(java.util.List<java.lang.String> modifiers)private booleanisNewClassFromLastVersion(com.thoughtworks.qdox.model.JavaClass javaClass)Check under Clirr if this given class is newer from the last version.private booleanisNewMethodFromLastRevision(com.thoughtworks.qdox.model.JavaExecutable javaExecutable)Check under Clirr if this given method is newer from the last version.private voidparseClirrTextOutputFile(java.io.File clirrTextOutputFile)(package private) AbstractFixJavadocMojo.JavaEntityTagsparseJavadocTags(java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaMethod)Parse entity tagsprivate booleanpreCheck()private voidprocessFix(com.thoughtworks.qdox.model.JavaClass javaClass)Process the givenJavaClass, ie add missing javadoc tags depending user parameters.private static java.lang.StringremoveLastEmptyJavadocLines(java.lang.String content)(package private) static java.lang.StringreplaceLinkTags(java.lang.String comment, com.thoughtworks.qdox.model.JavaAnnotatedElement entity)private booleansinceClassesContains(com.thoughtworks.qdox.model.JavaClass javaClass)private voidtakeCareSingleComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity)Take care of block or single comments between Javadoc comment and entity declaration ie:
1 /**
2 * {Javadoc Comment}
3 */
4 /*
5 * {Block Comment}
6 */
7 // {Single comment}
8 public void dummyMethod( String s ){}private static java.lang.StringtrimLeft(java.lang.String text)Trim a given line on the left:private static java.lang.StringtrimRight(java.lang.String text)Trim a given line on the right:private booleanupdateEntityComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent)private voidupdateJavadocComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent)private voidupdateJavadocComment(java.lang.StringBuilder sb, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent)private voidupdateJavadocTags(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, boolean isJavaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags)Write tags according javaEntityTags.private voidupdateJavadocTags(java.lang.StringBuilder sb, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable)private static voidwriteFile(java.io.File javaFile, java.lang.String encoding, java.lang.String content)Write content into the given javaFile and using the given encoding.private voidwriteParamTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags, java.lang.String paramName, java.lang.String paramValue)private voidwriteReturnTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaMethod javaMethod, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags)(package private) voidwriteThrowsTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags, java.util.List<java.lang.String> params)
-
-
-
Field Detail
-
EOL
private static final java.lang.String EOL
The vm line separator
-
AUTHOR_TAG
private static final java.lang.String AUTHOR_TAG
Tag name for @author *- See Also:
- Constant Field Values
-
VERSION_TAG
private static final java.lang.String VERSION_TAG
Tag name for @version *- See Also:
- Constant Field Values
-
SINCE_TAG
private static final java.lang.String SINCE_TAG
Tag name for @since *- See Also:
- Constant Field Values
-
PARAM_TAG
private static final java.lang.String PARAM_TAG
Tag name for @param *- See Also:
- Constant Field Values
-
RETURN_TAG
private static final java.lang.String RETURN_TAG
Tag name for @return *- See Also:
- Constant Field Values
-
THROWS_TAG
private static final java.lang.String THROWS_TAG
Tag name for @throws *- See Also:
- Constant Field Values
-
LINK_TAG
private static final java.lang.String LINK_TAG
Tag name for @link *- See Also:
- Constant Field Values
-
INHERITED_TAG
private static final java.lang.String INHERITED_TAG
Tag name for {@inheritDoc} *- See Also:
- Constant Field Values
-
START_JAVADOC
private static final java.lang.String START_JAVADOC
Start Javadoc String i.e./***- See Also:
- Constant Field Values
-
END_JAVADOC
private static final java.lang.String END_JAVADOC
End Javadoc String i.e.*/*- See Also:
- Constant Field Values
-
SEPARATOR_JAVADOC
private static final java.lang.String SEPARATOR_JAVADOC
Javadoc Separator i.e.**- See Also:
- Constant Field Values
-
INHERITED_JAVADOC
private static final java.lang.String INHERITED_JAVADOC
Inherited Javadoc i.e./** {@inheritDoc} */*- See Also:
- Constant Field Values
-
FIX_TAGS_ALL
private static final java.lang.String FIX_TAGS_ALL
allparameter used byfixTags*- See Also:
- Constant Field Values
-
LEVEL_PUBLIC
private static final java.lang.String LEVEL_PUBLIC
publicparameter used bylevel*- See Also:
- Constant Field Values
-
LEVEL_PROTECTED
private static final java.lang.String LEVEL_PROTECTED
protectedparameter used bylevel*- See Also:
- Constant Field Values
-
LEVEL_PACKAGE
private static final java.lang.String LEVEL_PACKAGE
packageparameter used bylevel*- See Also:
- Constant Field Values
-
LEVEL_PRIVATE
private static final java.lang.String LEVEL_PRIVATE
privateparameter used bylevel*- See Also:
- Constant Field Values
-
CLIRR_MAVEN_PLUGIN_GROUPID
private static final java.lang.String CLIRR_MAVEN_PLUGIN_GROUPID
The Clirr Maven plugin groupIdorg.codehaus.mojo*- See Also:
- Constant Field Values
-
CLIRR_MAVEN_PLUGIN_ARTIFACTID
private static final java.lang.String CLIRR_MAVEN_PLUGIN_ARTIFACTID
The Clirr Maven plugin artifactIdclirr-maven-plugin*- See Also:
- Constant Field Values
-
CLIRR_MAVEN_PLUGIN_VERSION
private static final java.lang.String CLIRR_MAVEN_PLUGIN_VERSION
The latest Clirr Maven plugin version2.2.2*- See Also:
- Constant Field Values
-
CLIRR_MAVEN_PLUGIN_GOAL
private static final java.lang.String CLIRR_MAVEN_PLUGIN_GOAL
The Clirr Maven plugin goalcheck*- See Also:
- Constant Field Values
-
JAVA_FILES
public static final java.lang.String JAVA_FILES
Java Files Pattern.- See Also:
- Constant Field Values
-
DEFAULT_VERSION_VALUE
public static final java.lang.String DEFAULT_VERSION_VALUE
Default version value.- See Also:
- Constant Field Values
-
inputHandler
@Component private org.codehaus.plexus.components.interactivity.InputHandler inputHandler
Input handler, needed for command line handling.
-
comparisonVersion
@Parameter(property="comparisonVersion", defaultValue="(,${project.version})") private java.lang.String comparisonVersion
-
defaultAuthor
@Parameter(property="defaultAuthor") private java.lang.String defaultAuthor
Default value for the Javadoc tag@author.
If not specified, theuser.namedefined in the System properties will be used.
-
defaultSince
@Parameter(property="defaultSince", defaultValue="${project.version}") private java.lang.String defaultSinceDefault value for the Javadoc tag@since.
-
defaultVersion
@Parameter(property="defaultVersion", defaultValue="$Id: $Id") private java.lang.String defaultVersionDefault value for the Javadoc tag@version.
By default, it is$Id:$, corresponding to a SVN keyword. Refer to your SCM to use an other SCM keyword.
-
encoding
@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") private java.lang.String encodingThe file encoding to use when reading the source files. If the propertyproject.build.sourceEncodingis not set, the platform default encoding is used.
-
excludes
@Parameter(property="excludes") private java.lang.String excludes
Comma separated excludes Java files, i.e.**/*Test.java.
-
fixTags
@Parameter(property="fixTags", defaultValue="all") private java.lang.String fixTagsComma separated tags to fix in classes, interfaces or methods Javadoc comments. Possible values are:- all (fix all Javadoc tags)
- author (fix only @author tag)
- version (fix only @version tag)
- since (fix only @since tag)
- param (fix only @param tag)
- return (fix only @return tag)
- throws (fix only @throws tag)
- link (fix only @link tag)
-
fixClassComment
@Parameter(property="fixClassComment", defaultValue="true") private boolean fixClassCommentFlag to fix the classes or interfaces Javadoc comments according thelevel.
-
fixFieldComment
@Parameter(property="fixFieldComment", defaultValue="true") private boolean fixFieldCommentFlag to fix the fields Javadoc comments according thelevel.
-
fixMethodComment
@Parameter(property="fixMethodComment", defaultValue="true") private boolean fixMethodCommentFlag to fix the methods Javadoc comments according thelevel.
-
removeUnknownThrows
@Parameter(property="removeUnknownThrows", defaultValue="true") private boolean removeUnknownThrowsFlag to remove throws tags from unknown classes.
NOTE:Since 3.1.0 the default value has been changed to
true, due to JavaDoc 8 strictness.
-
force
@Parameter(property="force") private boolean force
Forcing the goal execution i.e. skip warranty messages (not recommended).
-
ignoreClirr
@Parameter(property="ignoreClirr", defaultValue="false") protected boolean ignoreClirrFlag to ignore or not Clirr.
-
includes
@Parameter(property="includes", defaultValue="**\\/*.java") private java.lang.String includesComma separated includes Java files, i.e.**/*Test.java. Note: default value is**\/*.java.
-
level
@Parameter(property="level", defaultValue="protected") private java.lang.String levelSpecifies the access level for classes and members to show in the Javadocs. Possible values are:
-
localRepository
@Parameter(property="localRepository") private org.apache.maven.artifact.repository.ArtifactRepository localRepository
The local repository where the artifacts are located, used by the tests.
-
outputDirectory
@Parameter(property="outputDirectory", defaultValue="${project.build.sourceDirectory}") private java.io.File outputDirectoryOutput directory where Java classes will be rewritten.
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject projectThe Maven Project Object.
-
session
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session
-
settings
@Parameter(defaultValue="${settings}", readonly=true, required=true) private org.apache.maven.settings.Settings settingsThe current user system settings for use in Maven.
-
projectClassLoader
private java.lang.ClassLoader projectClassLoader
The current project class loader.
-
clirrNewClasses
private java.util.List<java.lang.String> clirrNewClasses
New classes found by Clirr.
-
clirrNewMethods
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> clirrNewMethods
New Methods in a Class (the key) found by Clirr.
-
sinceClasses
private java.util.List<java.lang.String> sinceClasses
List of classes where*sinceis added. Will be used to add or not this tag in the methods.
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getProject
protected final org.apache.maven.project.MavenProject getProject()
-
getArtifactType
protected java.lang.String getArtifactType(org.apache.maven.project.MavenProject p)
- Parameters:
p- not null maven project.- Returns:
- the artifact type.
-
getProjectSourceRoots
protected java.util.List<java.lang.String> getProjectSourceRoots(org.apache.maven.project.MavenProject p)
- Parameters:
p- not null maven project.- Returns:
- the list of source paths for the given project.
-
getCompileClasspathElements
protected java.util.List<java.lang.String> getCompileClasspathElements(org.apache.maven.project.MavenProject p) throws org.apache.maven.artifact.DependencyResolutionRequiredException- Parameters:
p- not null- Returns:
- the compile classpath elements
- Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException- if any
-
getJavaMethodAsString
protected static java.lang.String getJavaMethodAsString(com.thoughtworks.qdox.model.JavaExecutable javaExecutable)
- Parameters:
javaExecutable- not null- Returns:
- the fully qualify name of javaMethod with signature
-
init
private void init()
Init goal parameters.
-
preCheck
private boolean preCheck() throws org.apache.maven.plugin.MojoExecutionException- Returns:
trueif the user wants to proceed,falseotherwise.- Throws:
org.apache.maven.plugin.MojoExecutionException- if any
-
getProjectSourceDirectory
private java.io.File getProjectSourceDirectory()
- Returns:
- the source dir as File for the given project
-
executeClirr
private void executeClirr() throws org.apache.maven.shared.invoker.MavenInvocationExceptionInvoke Maven to run clirr-maven-plugin to find API differences.- Throws:
org.apache.maven.shared.invoker.MavenInvocationException- if any
-
parseClirrTextOutputFile
private void parseClirrTextOutputFile(java.io.File clirrTextOutputFile) throws java.io.IOException- Parameters:
clirrTextOutputFile- not null- Throws:
java.io.IOException- if any
-
fixTag
private boolean fixTag(java.lang.String tag)
- Parameters:
tag- not null- Returns:
trueiftagis defined infixTags.
-
getQdoxClasses
private java.util.Collection<com.thoughtworks.qdox.model.JavaClass> getQdoxClasses() throws java.io.IOException, org.apache.maven.plugin.MojoExecutionExceptionCalling Qdox to findJavaClassobjects from the Maven project sources. Ignore java class if Qdox has parsing errors.- Returns:
- an array of
JavaClassfound by QDox - Throws:
java.io.IOException- if anyorg.apache.maven.plugin.MojoExecutionException- if any
-
getProjectClassLoader
private java.lang.ClassLoader getProjectClassLoader() throws org.apache.maven.plugin.MojoExecutionException- Returns:
- the classLoader for the given project using lazy instantiation.
- Throws:
org.apache.maven.plugin.MojoExecutionException- if any
-
processFix
private void processFix(com.thoughtworks.qdox.model.JavaClass javaClass) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionExceptionProcess the givenJavaClass, ie add missing javadoc tags depending user parameters.- Parameters:
javaClass- not null- Throws:
java.io.IOException- if anyorg.apache.maven.plugin.MojoExecutionException- if any
-
takeCareSingleComment
private void takeCareSingleComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity) throws java.io.IOExceptionTake care of block or single comments between Javadoc comment and entity declaration ie:
1 /**
2 * {Javadoc Comment}
3 */
4 /*
5 * {Block Comment}
6 */
7 // {Single comment}
8 public void dummyMethod( String s ){}- Parameters:
stringWriter- not nulloriginalContent- not nullentity- not null- Throws:
java.io.IOException- if any- See Also:
extractOriginalJavadoc(java.lang.String, com.thoughtworks.qdox.model.JavaAnnotatedElement)
-
fixClassComment
private boolean fixClassComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaClass javaClass, java.lang.String indent) throws org.apache.maven.plugin.MojoExecutionException, java.io.IOExceptionAdd/update Javadoc class comment.- Parameters:
stringWriter-originalContent-javaClass-indent-- Returns:
trueif the comment is updated, otherwisefalse- Throws:
org.apache.maven.plugin.MojoExecutionExceptionjava.io.IOException
-
isInLevel
private boolean isInLevel(java.util.List<java.lang.String> modifiers)
- Parameters:
modifiers- list of modifiers (public, private, protected, package)- Returns:
trueif modifier is align withlevel.
-
addDefaultClassComment
private void addDefaultClassComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaClass javaClass, java.lang.String indent)Add a default Javadoc for the given class, i.e.:
1 /**
2 * {Comment based on the class name}
3 *
4 * @author X {added if addMissingAuthor}
5 * @version X {added if addMissingVersion}
6 * @since X {added if addMissingSince and new classes from previous version}
7 */
8 public class DummyClass {}- Parameters:
stringWriter- not nulljavaClass- not nullindent- not null- See Also:
getDefaultClassJavadocComment(JavaClass),appendDefaultAuthorTag(StringBuilder, String),appendDefaultSinceTag(StringBuilder, String),appendDefaultVersionTag(StringBuilder, String)
-
fixFieldComment
private boolean fixFieldComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaClass javaClass, com.thoughtworks.qdox.model.JavaField field, java.lang.String indent) throws java.io.IOExceptionAdd Javadoc field comment, only for static fields or interface fields.- Parameters:
stringWriter- not nulljavaClass- not nullfield- not nullindent- not null- Returns:
trueif comment was updated, otherwisefalse- Throws:
java.io.IOException- if any
-
addDefaultFieldComment
private void addDefaultFieldComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaField field, java.lang.String indent) throws java.io.IOExceptionAdd a default Javadoc for the given field, i.e.:
1 /** Constant <code> MY_STRING_CONSTANT="value" </code> */
2 public static final String MY_STRING_CONSTANT = "value";- Parameters:
stringWriter- not nullfield- not nullindent- not null- Throws:
java.io.IOException- if any
-
fixMethodComment
private boolean fixMethodComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, java.lang.String indent) throws org.apache.maven.plugin.MojoExecutionException, java.io.IOExceptionAdd/update Javadoc method comment.- Parameters:
stringWriter- not nulloriginalContent- not nulljavaExecutable- not nullindent- not null- Returns:
trueif comment was updated, otherwisefalse- Throws:
org.apache.maven.plugin.MojoExecutionException- if anyjava.io.IOException- if any
-
addDefaultMethodComment
private void addDefaultMethodComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, java.lang.String indent) throws org.apache.maven.plugin.MojoExecutionExceptionAdd in the buffer a default Javadoc for the given class:
1 /**
2 * {Comment based on the method name}
3 *
4 * @param X {added if addMissingParam}
5 * @return X {added if addMissingReturn}
6 * @throws X {added if addMissingThrows}
7 * @since X {added if addMissingSince and new classes from previous version}
8 */
9 public void dummyMethod ( String s ){}- Parameters:
stringWriter- not nulljavaExecutable- not nullindent- not null- Throws:
org.apache.maven.plugin.MojoExecutionException- if any- See Also:
getDefaultMethodJavadocComment(com.thoughtworks.qdox.model.JavaExecutable),appendDefaultSinceTag(StringBuilder, String)
-
updateEntityComment
private boolean updateEntityComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent) throws org.apache.maven.plugin.MojoExecutionException, java.io.IOException- Parameters:
stringWriter- not nulloriginalContent- not nullentity- not nullindent- not null- Returns:
- the updated changeDetected flag
- Throws:
org.apache.maven.plugin.MojoExecutionException- if anyjava.io.IOException- if any
-
updateJavadocComment
private void updateJavadocComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent) throws org.apache.maven.plugin.MojoExecutionException, java.io.IOException- Parameters:
stringWriter- not nulloriginalContent- not nullentity- not nullindent- not null- Throws:
org.apache.maven.plugin.MojoExecutionException- if anyjava.io.IOException- if any
-
updateJavadocComment
private void updateJavadocComment(java.lang.StringBuilder sb, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent) throws java.io.IOException- Parameters:
sb- not nulloriginalContent- not nullentity- not nullindent- not null- Throws:
java.io.IOException- if any
-
replaceLinkTags
static java.lang.String replaceLinkTags(java.lang.String comment, com.thoughtworks.qdox.model.JavaAnnotatedElement entity)
-
addDefaultJavadocComment
private void addDefaultJavadocComment(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable)- Parameters:
sb- not nullentity- not nullindent- not nullisJavaExecutable-
-
updateJavadocTags
private void updateJavadocTags(java.lang.StringBuilder sb, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException- Parameters:
sb- not nulloriginalContent- not nullentity- not nullindent- not nullisJavaExecutable-- Throws:
java.io.IOException- if anyorg.apache.maven.plugin.MojoExecutionException- if any
-
parseJavadocTags
AbstractFixJavadocMojo.JavaEntityTags parseJavadocTags(java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaMethod) throws java.io.IOException
Parse entity tags- Parameters:
originalContent- not nullentity- not nullindent- not nullisJavaMethod-- Returns:
- an instance of
AbstractFixJavadocMojo.JavaEntityTags - Throws:
java.io.IOException- if any
-
updateJavadocTags
private void updateJavadocTags(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, boolean isJavaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags)Write tags according javaEntityTags.- Parameters:
sb- not nullentity- not nullisJavaExecutable-javaEntityTags- not null
-
writeParamTag
private void writeParamTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags, java.lang.String paramName, java.lang.String paramValue)
-
writeReturnTag
private void writeReturnTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaMethod javaMethod, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags)
-
writeThrowsTag
void writeThrowsTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags, java.util.List<java.lang.String> params)
-
addMissingJavadocTags
private void addMissingJavadocTags(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags) throws org.apache.maven.plugin.MojoExecutionExceptionAdd missing tags not already written.- Parameters:
sb- not nullentity- not nullindent- not nullisJavaExecutable-javaEntityTags- not null- Throws:
org.apache.maven.plugin.MojoExecutionException- if any
-
addDefaultJavadocTags
private void addDefaultJavadocTags(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable) throws org.apache.maven.plugin.MojoExecutionException- Parameters:
sb- not nullentity- not nullindent- not nullisJavaExecutable-- Throws:
org.apache.maven.plugin.MojoExecutionException- if any
-
appendDefaultAuthorTag
private boolean appendDefaultAuthorTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)- Parameters:
sb- not nullindent- not nullseparatorAdded-- Returns:
- true if separator has been added.
-
appendDefaultAuthorTag
private void appendDefaultAuthorTag(java.lang.StringBuilder sb, java.lang.String indent)- Parameters:
sb- not nullindent- not null
-
appendDefaultSinceTag
private boolean appendDefaultSinceTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)- Parameters:
sb- not nullindent- not nullseparatorAdded-- Returns:
- true if separator has been added.
-
appendDefaultSinceTag
private void appendDefaultSinceTag(java.lang.StringBuilder sb, java.lang.String indent)- Parameters:
sb- not nullindent- not null
-
appendDefaultVersionTag
private boolean appendDefaultVersionTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)- Parameters:
sb- not nullindent- not nullseparatorAdded-- Returns:
- true if separator has been added.
-
appendDefaultVersionTag
private void appendDefaultVersionTag(java.lang.StringBuilder sb, java.lang.String indent)- Parameters:
sb- not nullindent- not null
-
appendDefaultParamTag
private boolean appendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaParameter typeParam)- Parameters:
sb- not nullindent- not nullseparatorAdded-typeParam- not null- Returns:
- true if separator has been added.
-
appendDefaultParamTag
private boolean appendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)- Parameters:
sb- not nullindent- not nullseparatorAdded-typeParameter- not null- Returns:
- true if separator has been added.
-
appendDefaultParamTag
private void appendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaParameter typeParam)- Parameters:
sb- not nullindent- not nulltypeParam- not null
-
appendDefaultParamTag
private void appendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)- Parameters:
sb- not nullindent- not nulltypeParameter- not null
-
appendDefaultReturnTag
private boolean appendDefaultReturnTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaMethod javaMethod)- Parameters:
sb- not nullindent- not nullseparatorAdded-javaMethod- not null- Returns:
- true if separator has been added.
-
appendDefaultReturnTag
private void appendDefaultReturnTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaMethod javaMethod)- Parameters:
sb- not nullindent- not nulljavaMethod- not null
-
appendDefaultThrowsTag
private boolean appendDefaultThrowsTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaType exception)- Parameters:
sb- not nullindent- not nullseparatorAdded-exception- not null- Returns:
- true if separator has been added.
-
appendDefaultThrowsTag
private void appendDefaultThrowsTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaType exception)- Parameters:
sb- not nullindent- not nullexception- not null
-
appendSeparator
private void appendSeparator(java.lang.StringBuilder sb, java.lang.String indent)- Parameters:
sb- not nullindent- not null
-
isInherited
private boolean isInherited(com.thoughtworks.qdox.model.JavaExecutable javaMethod) throws org.apache.maven.plugin.MojoExecutionExceptionVerify if a method has@java.lang.Override()annotation or if it is an inherited method from an interface or a super class. The goal is to handle{@inheritDoc}tag.- Parameters:
javaMethod- not null- Returns:
trueif the method is inherited,falseotherwise.- Throws:
org.apache.maven.plugin.MojoExecutionException- if any
-
isInherited
private boolean isInherited(java.lang.Class<?> clazz, com.thoughtworks.qdox.model.JavaExecutable javaMethod)- Parameters:
clazz- the Java class object, not nulljavaMethod- the QDox JavaMethod object not null- Returns:
trueifjavaMethodexists in the givenclazz,falseotherwise.- See Also:
isInherited(JavaExecutable)
-
getDefaultJavadocForType
private java.lang.String getDefaultJavadocForType(com.thoughtworks.qdox.model.JavaClass clazz)
- Parameters:
clazz-- Returns:
-
getDefaultJavadocForType
private java.lang.String getDefaultJavadocForType(com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)
-
isNewClassFromLastVersion
private boolean isNewClassFromLastVersion(com.thoughtworks.qdox.model.JavaClass javaClass)
Check under Clirr if this given class is newer from the last version.- Parameters:
javaClass- a given class not null- Returns:
trueif Clirr said that this class is added from the last version,falseotherwise or ifclirrNewClassesis null.
-
isNewMethodFromLastRevision
private boolean isNewMethodFromLastRevision(com.thoughtworks.qdox.model.JavaExecutable javaExecutable) throws org.apache.maven.plugin.MojoExecutionExceptionCheck under Clirr if this given method is newer from the last version.- Parameters:
javaExecutable- a given method not null- Returns:
trueif Clirr said that this method is added from the last version,falseotherwise or ifclirrNewMethodsis null.- Throws:
org.apache.maven.plugin.MojoExecutionException- if any
-
getClass
private java.lang.Class<?> getClass(java.lang.String className) throws org.apache.maven.plugin.MojoExecutionException- Parameters:
className- not null- Returns:
- the Class corresponding to the given class name using the project classloader.
- Throws:
org.apache.maven.plugin.MojoExecutionException- if class not found- See Also:
ClassUtils.getClass(ClassLoader, String, boolean),getProjectClassLoader()
-
getClass
private java.lang.Class<?> getClass(com.thoughtworks.qdox.model.JavaClass currentClass, java.lang.String exceptionClassName)Returns the Class object assignable forRuntimeExceptionclass and associated with the given exception class name.- Parameters:
currentClass- not nullexceptionClassName- not null, an exception class name defined as:- exception class fully qualified
- exception class in the same package
- exception inner class
- exception class in java.lang package
- Returns:
- the class if found, otherwise
null. - See Also:
getClass(String)
-
addSinceClasses
private void addSinceClasses(com.thoughtworks.qdox.model.JavaClass javaClass)
- Parameters:
javaClass- not null
-
sinceClassesContains
private boolean sinceClassesContains(com.thoughtworks.qdox.model.JavaClass javaClass)
-
writeFile
private static void writeFile(java.io.File javaFile, java.lang.String encoding, java.lang.String content) throws java.io.IOExceptionWrite content into the given javaFile and using the given encoding. All line separators will be unified.- Parameters:
javaFile- not nullencoding- not nullcontent- not null- Throws:
java.io.IOException- if any
-
getFullClirrGoal
private static java.lang.String getFullClirrGoal()
- Returns:
- the full clirr goal, i.e.
groupId:artifactId:version:goal. The clirr-plugin version could be load from the pom.properties in the clirr-maven-plugin dependency.
-
getDefaultClassJavadocComment
private static java.lang.String getDefaultClassJavadocComment(com.thoughtworks.qdox.model.JavaClass javaClass)
Default comment for class.- Parameters:
javaClass- not null- Returns:
- a default comment for class.
-
getDefaultMethodJavadocComment
private static java.lang.String getDefaultMethodJavadocComment(com.thoughtworks.qdox.model.JavaExecutable javaExecutable)
Default comment for method with taking care of getter/setter in the javaMethod name.- Parameters:
javaExecutable- not null- Returns:
- a default comment for method.
-
hasInheritedTag
private static boolean hasInheritedTag(java.lang.String content)
Try to find if a Javadoc comment has anINHERITED_TAGfor instance:/** {@inheritDoc} */or/** * {@inheritDoc} */- Parameters:
content- not null- Returns:
trueif the content has an inherited tag,falseotherwise.
-
getJavadocComment
static java.lang.String getJavadocComment(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity) throws java.io.IOExceptionWorkaround for QDOX-146 about whitespace. Ideally we want to useentity.getComment()
For instance, with the following snippet:
1
2 /**
3 * Dummy Javadoc comment.
4 * @param s a String
5 */
6 public void dummyMethod( String s ){}
The return will be:
1 * Dummy Javadoc comment.
- Parameters:
javaClassContent- original class content not nullentity- not null- Returns:
- the javadoc comment for the entity without any tags.
- Throws:
java.io.IOException- if any
-
getJavadocComment
java.lang.String getJavadocComment(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, com.thoughtworks.qdox.model.DocletTag docletTag) throws java.io.IOExceptionWork around for QDOX-146 about whitespace. Ideally we want to usedocletTag.getValue()
For instance, with the following snippet:
1
2 /**
3 * Dummy Javadoc comment.
4 * @param s a String
5 */
6 public void dummyMethod( String s ){}
The return will be:
1 * @param s a String
- Parameters:
javaClassContent- original class content not nullentity- not nulldocletTag- not null- Returns:
- the javadoc comment for the entity without Javadoc tags.
- Throws:
java.io.IOException- if any
-
extractOriginalJavadoc
static java.lang.String extractOriginalJavadoc(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity) throws java.io.IOExceptionExtract the original Javadoc and others comments up toSTART_JAVADOCform the entity. This method takes care of the Javadoc indentation. All javadoc lines will be trimmed on right.
For instance, with the following snippet:
1
2 /**
3 * Dummy Javadoc comment.
4 * @param s a String
5 */
6 public void dummyMethod( String s ){}
The return will be:
1 /**
2 * Dummy Javadoc comment.
3 * @param s a String
4 */
- Parameters:
javaClassContent- not nullentity- not null- Returns:
- return the original javadoc as String for the current entity
- Throws:
java.io.IOException- if any
-
extractOriginalJavadocContent
static java.lang.String extractOriginalJavadocContent(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity) throws java.io.IOExceptionExtract the Javadoc comment betweenSTART_JAVADOCandEND_JAVADOCform the entity. This method takes care of the Javadoc indentation. All javadoc lines will be trimmed on right.
For instance, with the following snippet:
1
2 /**
3 * Dummy Javadoc comment.
4 * @param s a String
5 */
6 public void dummyMethod( String s ){}
The return will be:
1 * Dummy Javadoc comment.
2 * @param s a String
- Parameters:
javaClassContent- not nullentity- not null- Returns:
- return the original javadoc as String for the current entity
- Throws:
java.io.IOException- if any
-
removeLastEmptyJavadocLines
private static java.lang.String removeLastEmptyJavadocLines(java.lang.String content) throws java.io.IOException- Parameters:
content- not null- Returns:
- the content without last lines containing javadoc separator (ie
*) - Throws:
java.io.IOException- if any- See Also:
getJavadocComment(String, JavaAnnotatedElement, DocletTag)
-
alignIndentationJavadocLines
private static java.lang.String alignIndentationJavadocLines(java.lang.String content, java.lang.String indent) throws java.io.IOException- Parameters:
content- not null- Returns:
- the javadoc comment with the given indentation
- Throws:
java.io.IOException- if any- See Also:
getJavadocComment(String, JavaAnnotatedElement, DocletTag)
-
autodetectIndentation
private static java.lang.String autodetectIndentation(java.lang.String line)
Autodetect the indentation of a given line:autodetectIndentation( null ) = ""; autodetectIndentation( "a" ) = ""; autodetectIndentation( " a" ) = " "; autodetectIndentation( "\ta" ) = "\t";
- Parameters:
line- not null- Returns:
- the indentation for the given line.
-
getLines
private static java.lang.String[] getLines(java.lang.String content) throws java.io.IOException- Parameters:
content- not null- Returns:
- an array of all content lines
- Throws:
java.io.IOException- if any
-
trimLeft
private static java.lang.String trimLeft(java.lang.String text)
Trim a given line on the left:trimLeft( null ) = ""; trimLeft( " " ) = ""; trimLeft( "a" ) = "a"; trimLeft( " a" ) = "a"; trimLeft( "\ta" ) = "a"; trimLeft( " a " ) = "a ";
- Parameters:
text-- Returns:
- the text trimmed on left side or empty if text is null.
-
trimRight
private static java.lang.String trimRight(java.lang.String text)
Trim a given line on the right:trimRight( null ) = ""; trimRight( " " ) = ""; trimRight( "a" ) = "a"; trimRight( "a\t" ) = "a"; trimRight( " a " ) = " a";
- Parameters:
text-- Returns:
- the text trimmed on tight side or empty if text is null.
-
-