public abstract class AbstractFixJavadocMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Class and Description |
---|---|
(package private) class |
AbstractFixJavadocMojo.JavaEntityTags
Wrapper class for the entity's tags.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
AUTHOR_TAG
Tag name for @author *
|
private static java.lang.String |
CLIRR_MAVEN_PLUGIN_ARTIFACTID
The Clirr Maven plugin artifactId
clirr-maven-plugin * |
private static java.lang.String |
CLIRR_MAVEN_PLUGIN_GOAL
The Clirr Maven plugin goal
check * |
private static java.lang.String |
CLIRR_MAVEN_PLUGIN_GROUPID
The Clirr Maven plugin groupId
org.codehaus.mojo * |
private static java.lang.String |
CLIRR_MAVEN_PLUGIN_VERSION
The latest Clirr Maven plugin version
2.2.2 * |
private java.util.List<java.lang.String> |
clirrNewClasses
New classes found by Clirr.
|
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
clirrNewMethods
New Methods in a Class (the key) found by Clirr.
|
private java.lang.String |
comparisonVersion
Version to compare the current code against using the
Clirr Maven Plugin.
|
static java.lang.String |
DEFAULT_VERSION_VALUE
Default version value.
|
private java.lang.String |
defaultAuthor
Default value for the Javadoc tag
@author . |
private java.lang.String |
defaultSince
Default value for the Javadoc tag
@since . |
private java.lang.String |
defaultVersion
Default value for the Javadoc tag
@version . |
private java.lang.String |
encoding
The file encoding to use when reading the source files.
|
private static java.lang.String |
END_JAVADOC
End Javadoc String i.e.
|
private static java.lang.String |
EOL
The vm line separator
|
private java.lang.String |
excludes
Comma separated excludes Java files, i.e.
|
private static java.lang.String |
FIX_TAGS_ALL
all parameter used by fixTags * |
private boolean |
fixClassComment
Flag to fix the classes or interfaces Javadoc comments according the
level . |
private boolean |
fixFieldComment
Flag to fix the fields Javadoc comments according the
level . |
private boolean |
fixMethodComment
Flag to fix the methods Javadoc comments according the
level . |
private java.lang.String |
fixTags
Comma separated tags to fix in classes, interfaces or methods Javadoc comments.
|
private java.lang.String[] |
fixTagsSplitted
Split
fixTags by comma. |
private boolean |
force
Forcing the goal execution i.e.
|
protected boolean |
ignoreClirr
Flag to ignore or not Clirr.
|
private java.lang.String |
includes
Comma separated includes Java files, i.e.
|
private static java.lang.String |
INHERITED_JAVADOC
Inherited Javadoc i.e.
|
private static java.lang.String |
INHERITED_TAG
Tag name for {@inheritDoc} *
|
private org.codehaus.plexus.components.interactivity.InputHandler |
inputHandler
Input handler, needed for command line handling.
|
static java.lang.String |
JAVA_FILES
Java Files Pattern.
|
private java.lang.String |
level
Specifies the access level for classes and members to show in the Javadocs.
|
private static java.lang.String |
LEVEL_PACKAGE
package parameter used by level * |
private static java.lang.String |
LEVEL_PRIVATE
private parameter used by level * |
private static java.lang.String |
LEVEL_PROTECTED
protected parameter used by level * |
private static java.lang.String |
LEVEL_PUBLIC
public parameter used by level * |
private static java.lang.String |
LINK_TAG
Tag name for @link *
|
private org.apache.maven.artifact.repository.ArtifactRepository |
localRepository
The local repository where the artifacts are located, used by the tests.
|
private java.io.File |
outputDirectory
Output directory where Java classes will be rewritten.
|
private static java.lang.String |
PARAM_TAG
Tag name for @param *
|
private org.apache.maven.project.MavenProject |
project
The Maven Project Object.
|
private java.lang.ClassLoader |
projectClassLoader
The current project class loader.
|
private boolean |
removeUnknownThrows
Flag to remove throws tags from unknown classes.
|
private static java.lang.String |
RETURN_TAG
Tag name for @return *
|
private static java.lang.String |
SEPARATOR_JAVADOC
Javadoc Separator i.e.
|
private org.apache.maven.settings.Settings |
settings
The current user system settings for use in Maven.
|
private static java.lang.String |
SINCE_TAG
Tag name for @since *
|
private java.util.List<java.lang.String> |
sinceClasses
List of classes where
*since is added. |
private static java.lang.String |
START_JAVADOC
Start Javadoc String i.e.
|
private static java.lang.String |
THROWS_TAG
Tag name for @throws *
|
private static java.lang.String |
VERSION_TAG
Tag name for @version *
|
Constructor and Description |
---|
AbstractFixJavadocMojo() |
Modifier and Type | Method and Description |
---|---|
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
/**
|
private void |
addDefaultFieldComment(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> */ |
private void |
addDefaultJavadocComment(java.lang.StringBuilder sb,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity,
java.lang.String indent,
boolean isJavaExecutable) |
private void |
addDefaultJavadocTags(java.lang.StringBuilder sb,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity,
java.lang.String indent,
boolean isJavaExecutable) |
private void |
addDefaultMethodComment(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
/** |
private void |
addMissingJavadocTags(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 void |
addSinceClasses(com.thoughtworks.qdox.model.JavaClass javaClass) |
private static java.lang.String |
alignIndentationJavadocLines(java.lang.String content,
java.lang.String indent) |
private void |
appendDefaultAuthorTag(java.lang.StringBuilder sb,
java.lang.String indent) |
private boolean |
appendDefaultAuthorTag(java.lang.StringBuilder sb,
java.lang.String indent,
boolean separatorAdded) |
private boolean |
appendDefaultParamTag(java.lang.StringBuilder sb,
java.lang.String indent,
boolean separatorAdded,
com.thoughtworks.qdox.model.JavaParameter typeParam) |
private boolean |
appendDefaultParamTag(java.lang.StringBuilder sb,
java.lang.String indent,
boolean separatorAdded,
com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter) |
private void |
appendDefaultParamTag(java.lang.StringBuilder sb,
java.lang.String indent,
com.thoughtworks.qdox.model.JavaParameter typeParam) |
private void |
appendDefaultParamTag(java.lang.StringBuilder sb,
java.lang.String indent,
com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter) |
private boolean |
appendDefaultReturnTag(java.lang.StringBuilder sb,
java.lang.String indent,
boolean separatorAdded,
com.thoughtworks.qdox.model.JavaMethod javaMethod) |
private void |
appendDefaultReturnTag(java.lang.StringBuilder sb,
java.lang.String indent,
com.thoughtworks.qdox.model.JavaMethod javaMethod) |
private void |
appendDefaultSinceTag(java.lang.StringBuilder sb,
java.lang.String indent) |
private boolean |
appendDefaultSinceTag(java.lang.StringBuilder sb,
java.lang.String indent,
boolean separatorAdded) |
private boolean |
appendDefaultThrowsTag(java.lang.StringBuilder sb,
java.lang.String indent,
boolean separatorAdded,
com.thoughtworks.qdox.model.JavaType exception) |
private void |
appendDefaultThrowsTag(java.lang.StringBuilder sb,
java.lang.String indent,
com.thoughtworks.qdox.model.JavaType exception) |
private void |
appendDefaultVersionTag(java.lang.StringBuilder sb,
java.lang.String indent) |
private boolean |
appendDefaultVersionTag(java.lang.StringBuilder sb,
java.lang.String indent,
boolean separatorAdded) |
private void |
appendSeparator(java.lang.StringBuilder sb,
java.lang.String indent) |
private static java.lang.String |
autodetectIndentation(java.lang.String line)
Autodetect the indentation of a given line:
|
void |
execute() |
private void |
executeClirr()
Invoke Maven to run clirr-maven-plugin to find API differences.
|
(package private) static java.lang.String |
extractOriginalJavadoc(java.lang.String javaClassContent,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity)
Extract the original Javadoc and others comments up to
START_JAVADOC form the entity. |
(package private) static java.lang.String |
extractOriginalJavadocContent(java.lang.String javaClassContent,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity)
Extract the Javadoc comment between
START_JAVADOC and END_JAVADOC form the entity. |
private boolean |
fixClassComment(java.io.StringWriter stringWriter,
java.lang.String originalContent,
com.thoughtworks.qdox.model.JavaClass javaClass,
java.lang.String indent)
Add/update Javadoc class comment.
|
private boolean |
fixFieldComment(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 boolean |
fixMethodComment(java.io.StringWriter stringWriter,
java.lang.String originalContent,
com.thoughtworks.qdox.model.JavaExecutable javaExecutable,
java.lang.String indent)
Add/update Javadoc method comment.
|
private boolean |
fixTag(java.lang.String tag) |
protected java.lang.String |
getArtifactType(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 for
RuntimeException class 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.String |
getDefaultClassJavadocComment(com.thoughtworks.qdox.model.JavaClass javaClass)
Default comment for class.
|
private java.lang.String |
getDefaultJavadocForType(com.thoughtworks.qdox.model.JavaClass clazz) |
private java.lang.String |
getDefaultJavadocForType(com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter) |
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.
|
private static java.lang.String |
getFullClirrGoal() |
(package private) static java.lang.String |
getJavadocComment(java.lang.String javaClassContent,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity)
Workaround for QDOX-146 about whitespace.
|
(package private) java.lang.String |
getJavadocComment(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.String |
getJavaMethodAsString(com.thoughtworks.qdox.model.JavaExecutable javaExecutable) |
private static java.lang.String[] |
getLines(java.lang.String content) |
private java.lang.ClassLoader |
getProjectClassLoader() |
private java.io.File |
getProjectSourceDirectory() |
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 find
JavaClass objects from the Maven project sources. |
private static boolean |
hasInheritedTag(java.lang.String content)
Try to find if a Javadoc comment has an
INHERITED_TAG for instance: |
private void |
init()
Init goal parameters.
|
private boolean |
isInherited(java.lang.Class<?> clazz,
com.thoughtworks.qdox.model.JavaExecutable javaMethod) |
private boolean |
isInherited(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 boolean |
isInLevel(java.util.List<java.lang.String> modifiers) |
private boolean |
isNewClassFromLastVersion(com.thoughtworks.qdox.model.JavaClass javaClass)
Check under Clirr if this given class is newer from the last version.
|
private boolean |
isNewMethodFromLastRevision(com.thoughtworks.qdox.model.JavaExecutable javaExecutable)
Check under Clirr if this given method is newer from the last version.
|
private void |
parseClirrTextOutputFile(java.io.File clirrTextOutputFile) |
(package private) AbstractFixJavadocMojo.JavaEntityTags |
parseJavadocTags(java.lang.String originalContent,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity,
java.lang.String indent,
boolean isJavaMethod)
Parse entity tags
|
private boolean |
preCheck() |
private void |
processFix(com.thoughtworks.qdox.model.JavaClass javaClass)
Process the given
JavaClass , ie add missing javadoc tags depending user parameters. |
private static java.lang.String |
removeLastEmptyJavadocLines(java.lang.String content) |
(package private) static java.lang.String |
replaceLinkTags(java.lang.String comment,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity) |
private boolean |
sinceClassesContains(com.thoughtworks.qdox.model.JavaClass javaClass) |
private void |
takeCareSingleComment(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
/** |
private static java.lang.String |
trimLeft(java.lang.String text)
Trim a given line on the left:
|
private static java.lang.String |
trimRight(java.lang.String text)
Trim a given line on the right:
|
private boolean |
updateEntityComment(java.io.StringWriter stringWriter,
java.lang.String originalContent,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity,
java.lang.String indent) |
private void |
updateJavadocComment(java.lang.StringBuilder sb,
java.lang.String originalContent,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity,
java.lang.String indent) |
private void |
updateJavadocComment(java.io.StringWriter stringWriter,
java.lang.String originalContent,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity,
java.lang.String indent) |
private void |
updateJavadocTags(java.lang.StringBuilder sb,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity,
boolean isJavaExecutable,
AbstractFixJavadocMojo.JavaEntityTags javaEntityTags)
Write tags according javaEntityTags.
|
private void |
updateJavadocTags(java.lang.StringBuilder sb,
java.lang.String originalContent,
com.thoughtworks.qdox.model.JavaAnnotatedElement entity,
java.lang.String indent,
boolean isJavaExecutable) |
private static void |
writeFile(java.io.File javaFile,
java.lang.String encoding,
java.lang.String content)
Write content into the given javaFile and using the given encoding.
|
private void |
writeParamTag(java.lang.StringBuilder sb,
com.thoughtworks.qdox.model.JavaExecutable javaExecutable,
AbstractFixJavadocMojo.JavaEntityTags javaEntityTags,
java.util.List<java.lang.String> params) |
private void |
writeReturnTag(java.lang.StringBuilder sb,
com.thoughtworks.qdox.model.JavaMethod javaMethod,
AbstractFixJavadocMojo.JavaEntityTags javaEntityTags) |
(package private) void |
writeThrowsTag(java.lang.StringBuilder sb,
com.thoughtworks.qdox.model.JavaExecutable javaExecutable,
AbstractFixJavadocMojo.JavaEntityTags javaEntityTags,
java.util.List<java.lang.String> params) |
private static final java.lang.String EOL
private static final java.lang.String AUTHOR_TAG
private static final java.lang.String VERSION_TAG
private static final java.lang.String SINCE_TAG
private static final java.lang.String PARAM_TAG
private static final java.lang.String RETURN_TAG
private static final java.lang.String THROWS_TAG
private static final java.lang.String LINK_TAG
private static final java.lang.String INHERITED_TAG
private static final java.lang.String START_JAVADOC
/**
*private static final java.lang.String END_JAVADOC
*/
*private static final java.lang.String SEPARATOR_JAVADOC
*
*private static final java.lang.String INHERITED_JAVADOC
/** {@inheritDoc} */
*private static final java.lang.String FIX_TAGS_ALL
all
parameter used by fixTags
*private static final java.lang.String LEVEL_PUBLIC
public
parameter used by level
*private static final java.lang.String LEVEL_PROTECTED
protected
parameter used by level
*private static final java.lang.String LEVEL_PACKAGE
package
parameter used by level
*private static final java.lang.String LEVEL_PRIVATE
private
parameter used by level
*private static final java.lang.String CLIRR_MAVEN_PLUGIN_GROUPID
org.codehaus.mojo
*private static final java.lang.String CLIRR_MAVEN_PLUGIN_ARTIFACTID
clirr-maven-plugin
*private static final java.lang.String CLIRR_MAVEN_PLUGIN_VERSION
2.2.2
*private static final java.lang.String CLIRR_MAVEN_PLUGIN_GOAL
check
*public static final java.lang.String JAVA_FILES
public static final java.lang.String DEFAULT_VERSION_VALUE
@Component private org.codehaus.plexus.components.interactivity.InputHandler inputHandler
@Parameter(property="comparisonVersion", defaultValue="(,${project.version})") private java.lang.String comparisonVersion
@Parameter(property="defaultAuthor") private java.lang.String defaultAuthor
@author
.
user.name
defined in the System properties will be used.@Parameter(property="defaultSince", defaultValue="${project.version}") private java.lang.String defaultSince
@since
.@Parameter(property="defaultVersion", defaultValue="$Id: $Id") private java.lang.String defaultVersion
@version
.
$Id:$
, corresponding to a
SVN keyword.
Refer to your SCM to use an other SCM keyword.@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") private java.lang.String encoding
project.build.sourceEncoding
is not set, the platform default encoding is used.@Parameter(property="excludes") private java.lang.String excludes
**/*Test.java
.@Parameter(property="fixTags", defaultValue="all") private java.lang.String fixTags
@Parameter(property="fixClassComment", defaultValue="true") private boolean fixClassComment
level
.@Parameter(property="fixFieldComment", defaultValue="true") private boolean fixFieldComment
level
.@Parameter(property="fixMethodComment", defaultValue="true") private boolean fixMethodComment
level
.@Parameter(property="removeUnknownThrows", defaultValue="false") private boolean removeUnknownThrows
@Parameter(property="force") private boolean force
@Parameter(property="ignoreClirr", defaultValue="false") protected boolean ignoreClirr
@Parameter(property="includes", defaultValue="**\\/*.java") private java.lang.String includes
**/*Test.java
.
Note: default value is **\/*.java
.@Parameter(property="level", defaultValue="protected") private java.lang.String level
@Parameter(property="localRepository") private org.apache.maven.artifact.repository.ArtifactRepository localRepository
@Parameter(property="outputDirectory", defaultValue="${project.build.sourceDirectory}") private java.io.File outputDirectory
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${settings}", readonly=true, required=true) private org.apache.maven.settings.Settings settings
private java.lang.ClassLoader projectClassLoader
private java.lang.String[] fixTagsSplitted
fixTags
by comma.#init()}
private java.util.List<java.lang.String> clirrNewClasses
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> clirrNewMethods
private java.util.List<java.lang.String> sinceClasses
*since
is added. Will be used to add or not this tag in the methods.public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
protected java.lang.String getArtifactType(org.apache.maven.project.MavenProject p)
p
- not null maven project.protected java.util.List<java.lang.String> getProjectSourceRoots(org.apache.maven.project.MavenProject p)
p
- not null maven project.protected java.util.List<java.lang.String> getCompileClasspathElements(org.apache.maven.project.MavenProject p) throws org.apache.maven.artifact.DependencyResolutionRequiredException
p
- not nullorg.apache.maven.artifact.DependencyResolutionRequiredException
- if anyprotected static java.lang.String getJavaMethodAsString(com.thoughtworks.qdox.model.JavaExecutable javaExecutable)
javaExecutable
- not nullprivate void init()
private boolean preCheck() throws org.apache.maven.plugin.MojoExecutionException
true
if the user wants to proceed, false
otherwise.org.apache.maven.plugin.MojoExecutionException
- if anyprivate java.io.File getProjectSourceDirectory()
private void executeClirr() throws org.apache.maven.shared.invoker.MavenInvocationException
org.apache.maven.shared.invoker.MavenInvocationException
- if anyprivate void parseClirrTextOutputFile(java.io.File clirrTextOutputFile) throws java.io.IOException
clirrTextOutputFile
- not nulljava.io.IOException
- if anyprivate boolean fixTag(java.lang.String tag)
tag
- not nulltrue
if tag
is defined in fixTags
.private java.util.Collection<com.thoughtworks.qdox.model.JavaClass> getQdoxClasses() throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
JavaClass
objects from the Maven project sources.
Ignore java class if Qdox has parsing errors.JavaClass
found by QDoxjava.io.IOException
- if anyorg.apache.maven.plugin.MojoExecutionException
- if anyprivate java.lang.ClassLoader getProjectClassLoader() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- if anyprivate void processFix(com.thoughtworks.qdox.model.JavaClass javaClass) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
JavaClass
, ie add missing javadoc tags depending user parameters.javaClass
- not nulljava.io.IOException
- if anyorg.apache.maven.plugin.MojoExecutionException
- if anyprivate void takeCareSingleComment(java.io.StringWriter stringWriter, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity) throws java.io.IOException
1
/**
2
* {Javadoc Comment}
3
*/
4
/*
5
* {Block Comment}
6
*/
7
// {Single comment}
8
public void
dummyMethod(
String s ){}
stringWriter
- not nulloriginalContent
- not nullentity
- not nullchangeDetected
- java.io.IOException
- if any#extractOriginalJavadoc(String, AbstractJavaEntity)
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.IOException
stringWriter
- originalContent
- javaClass
- indent
- true
if the comment is updated, otherwise false
org.apache.maven.plugin.MojoExecutionException
java.io.IOException
private boolean isInLevel(java.util.List<java.lang.String> modifiers)
modifiers
- list of modifiers (public, private, protected, package)true
if modifier is align with level
.private void addDefaultClassComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaClass javaClass, java.lang.String indent)
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 {}
buffer
- not nulljavaClass
- not nullindent
- not nullgetDefaultClassJavadocComment(JavaClass)
,
appendDefaultAuthorTag(StringBuilder, String)
,
appendDefaultSinceTag(StringBuilder, String)
,
appendDefaultVersionTag(StringBuilder, String)
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.IOException
stringWriter
- not nulljavaClass
- not nullfield
- not nullindent
- not nulltrue
if comment was updated, otherwise false
java.io.IOException
- if anyprivate void addDefaultFieldComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaField field, java.lang.String indent) throws java.io.IOException
1
/** Constant <code>
MY_STRING_CONSTANT="value"
</code> */
2
public static final
String MY_STRING_CONSTANT =
"value";
stringWriter
- not nullfield
- not nullindent
- not nulljava.io.IOException
- if anyprivate 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.IOException
stringWriter
- not nulloriginalContent
- not nulljavaExecutable
- not nullindent
- not nulltrue
if comment was updated, otherwise false
org.apache.maven.plugin.MojoExecutionException
- if anyjava.io.IOException
- if anyprivate void addDefaultMethodComment(java.io.StringWriter stringWriter, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, java.lang.String indent) throws org.apache.maven.plugin.MojoExecutionException
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
){}
buffer
- not nulljavaExecutable
- not nullindent
- not nullorg.apache.maven.plugin.MojoExecutionException
- if any#getDefaultMethodJavadocComment(JavaMethod)
,
appendDefaultSinceTag(StringBuilder, String)
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
stringWriter
- not nulloriginalContent
- not nullentity
- not nullindent
- not nullchangeDetected
- org.apache.maven.plugin.MojoExecutionException
- if anyjava.io.IOException
- if anyprivate 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
stringWriter
- not nulloriginalContent
- not nullentity
- not nullindent
- not nullorg.apache.maven.plugin.MojoExecutionException
- if anyjava.io.IOException
- if anyprivate void updateJavadocComment(java.lang.StringBuilder sb, java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent) throws java.io.IOException
sb
- not nulloriginalContent
- not nullentity
- not nullindent
- not nulljava.io.IOException
- if anystatic java.lang.String replaceLinkTags(java.lang.String comment, com.thoughtworks.qdox.model.JavaAnnotatedElement entity)
private void addDefaultJavadocComment(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable)
sb
- not nullentity
- not nullindent
- not nullisJavaExecutable
- 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
sb
- not nulloriginalContent
- not nullentity
- not nullindent
- not nullisJavaExecutable
- java.io.IOException
- if anyorg.apache.maven.plugin.MojoExecutionException
- if anyAbstractFixJavadocMojo.JavaEntityTags parseJavadocTags(java.lang.String originalContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaMethod) throws java.io.IOException
originalContent
- not nullentity
- not nullindent
- not nullisJavaMethod
- AbstractFixJavadocMojo.JavaEntityTags
java.io.IOException
- if anyprivate void updateJavadocTags(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, boolean isJavaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags)
sb
- not nullentity
- not nullisJavaExecutable
- javaEntityTags
- not nullprivate void writeParamTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags, java.util.List<java.lang.String> params)
private void writeReturnTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaMethod javaMethod, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags)
void writeThrowsTag(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaExecutable javaExecutable, AbstractFixJavadocMojo.JavaEntityTags javaEntityTags, java.util.List<java.lang.String> params)
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.MojoExecutionException
sb
- not nullentity
- not nullindent
- not nullisJavaExecutable
- javaEntityTags
- not nullorg.apache.maven.plugin.MojoExecutionException
- if anyprivate void addDefaultJavadocTags(java.lang.StringBuilder sb, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, java.lang.String indent, boolean isJavaExecutable) throws org.apache.maven.plugin.MojoExecutionException
sb
- not nullentity
- not nullindent
- not nullisJavaExecutable
- org.apache.maven.plugin.MojoExecutionException
- if anyprivate boolean appendDefaultAuthorTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)
sb
- not nullindent
- not nullseparatorAdded
- private void appendDefaultAuthorTag(java.lang.StringBuilder sb, java.lang.String indent)
sb
- not nullindent
- not nullprivate boolean appendDefaultSinceTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)
sb
- not nullindent
- not nullseparatorAdded
- private void appendDefaultSinceTag(java.lang.StringBuilder sb, java.lang.String indent)
sb
- not nullindent
- not nullprivate boolean appendDefaultVersionTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded)
sb
- not nullindent
- not nullseparatorAdded
- private void appendDefaultVersionTag(java.lang.StringBuilder sb, java.lang.String indent)
sb
- not nullindent
- not nullprivate boolean appendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaParameter typeParam)
sb
- not nullindent
- not nullseparatorAdded
- typeParam
- not nullprivate boolean appendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)
sb
- not nullindent
- not nullseparatorAdded
- typeParameter
- not nullprivate void appendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaParameter typeParam)
sb
- not nullindent
- not nulltypeParam
- not nullprivate void appendDefaultParamTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)
sb
- not nullindent
- not nulltypeParameter
- not nullprivate boolean appendDefaultReturnTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaMethod javaMethod)
sb
- not nullindent
- not nullseparatorAdded
- javaMethod
- not nullprivate void appendDefaultReturnTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaMethod javaMethod)
sb
- not nullindent
- not nulljavaMethod
- not nullprivate boolean appendDefaultThrowsTag(java.lang.StringBuilder sb, java.lang.String indent, boolean separatorAdded, com.thoughtworks.qdox.model.JavaType exception)
sb
- not nullindent
- not nullseparatorAdded
- exception
- not nullprivate void appendDefaultThrowsTag(java.lang.StringBuilder sb, java.lang.String indent, com.thoughtworks.qdox.model.JavaType exception)
sb
- not nullindent
- not nullexception
- not nullprivate void appendSeparator(java.lang.StringBuilder sb, java.lang.String indent)
sb
- not nullindent
- not nullprivate boolean isInherited(com.thoughtworks.qdox.model.JavaExecutable javaMethod) throws org.apache.maven.plugin.MojoExecutionException
@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.javaMethod
- not nulltrue
if the method is inherited, false
otherwise.org.apache.maven.plugin.MojoExecutionException
- if anyprivate boolean isInherited(java.lang.Class<?> clazz, com.thoughtworks.qdox.model.JavaExecutable javaMethod)
clazz
- the Java class object, not nulljavaMethod
- the QDox JavaMethod object not nulltrue
if javaMethod
exists in the given clazz
,
false
otherwise.#isInherited(JavaMethod)
private java.lang.String getDefaultJavadocForType(com.thoughtworks.qdox.model.JavaClass clazz)
clazz
- private java.lang.String getDefaultJavadocForType(com.thoughtworks.qdox.model.JavaTypeVariable<com.thoughtworks.qdox.model.JavaGenericDeclaration> typeParameter)
private boolean isNewClassFromLastVersion(com.thoughtworks.qdox.model.JavaClass javaClass)
javaClass
- a given class not nulltrue
if Clirr said that this class is added from the last version,
false
otherwise or if clirrNewClasses
is null.private boolean isNewMethodFromLastRevision(com.thoughtworks.qdox.model.JavaExecutable javaExecutable) throws org.apache.maven.plugin.MojoExecutionException
javaExecutable
- a given method not nulltrue
if Clirr said that this method is added from the last version,
false
otherwise or if clirrNewMethods
is null.org.apache.maven.plugin.MojoExecutionException
- if anyprivate java.lang.Class<?> getClass(java.lang.String className) throws org.apache.maven.plugin.MojoExecutionException
className
- not nullorg.apache.maven.plugin.MojoExecutionException
- if class not foundClassUtils#getClass(ClassLoader, String, boolean)}
,
#getProjectClassLoader()}
private java.lang.Class<?> getClass(com.thoughtworks.qdox.model.JavaClass currentClass, java.lang.String exceptionClassName)
RuntimeException
class and associated with the given
exception class name.currentClass
- not nullexceptionClassName
- not null, an exception class name defined as:
null
.getClass(String)
private void addSinceClasses(com.thoughtworks.qdox.model.JavaClass javaClass)
javaClass
- not nullprivate boolean sinceClassesContains(com.thoughtworks.qdox.model.JavaClass javaClass)
private static void writeFile(java.io.File javaFile, java.lang.String encoding, java.lang.String content) throws java.io.IOException
javaFile
- not nullencoding
- not nullcontent
- not nulljava.io.IOException
- if anyprivate static java.lang.String getFullClirrGoal()
groupId:artifactId:version:goal
. The clirr-plugin version
could be load from the pom.properties in the clirr-maven-plugin dependency.private static java.lang.String getDefaultClassJavadocComment(com.thoughtworks.qdox.model.JavaClass javaClass)
javaClass
- not nullprivate static java.lang.String getDefaultMethodJavadocComment(com.thoughtworks.qdox.model.JavaExecutable javaExecutable)
javaExecutable
- not nullprivate static boolean hasInheritedTag(java.lang.String content)
INHERITED_TAG
for instance:
/** {@inheritDoc} */or
/** * {@inheritDoc} */
content
- not nulltrue
if the content has an inherited tag, false
otherwise.static java.lang.String getJavadocComment(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity) throws java.io.IOException
entity.getComment()
1
2
/**
3
* Dummy Javadoc comment.
4
* @param
s a String
5
*/
6
public void
dummyMethod(
String s ){}
1
* Dummy Javadoc comment.
javaClassContent
- original class content not nullentity
- not nulljava.io.IOException
- if anyjava.lang.String getJavadocComment(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity, com.thoughtworks.qdox.model.DocletTag docletTag) throws java.io.IOException
docletTag.getValue()
1
2
/**
3
* Dummy Javadoc comment.
4
* @param
s a String
5
*/
6
public void
dummyMethod(
String s ){}
1
* @param
s a String
javaClassContent
- original class content not nullentity
- not nulldocletTag
- not nulljava.io.IOException
- if anystatic java.lang.String extractOriginalJavadoc(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity) throws java.io.IOException
START_JAVADOC
form the entity. This method
takes care of the Javadoc indentation. All javadoc lines will be trimmed on right.
1
2
/**
3
* Dummy Javadoc comment.
4
* @param
s a String
5
*/
6
public void
dummyMethod(
String s ){}
1
/**
2
* Dummy Javadoc comment.
3
* @param
s a String
4
*/
javaClassContent
- not nullentity
- not nulljava.io.IOException
- if anystatic java.lang.String extractOriginalJavadocContent(java.lang.String javaClassContent, com.thoughtworks.qdox.model.JavaAnnotatedElement entity) throws java.io.IOException
START_JAVADOC
and END_JAVADOC
form the entity. This method
takes care of the Javadoc indentation. All javadoc lines will be trimmed on right.
1
2
/**
3
* Dummy Javadoc comment.
4
* @param
s a String
5
*/
6
public void
dummyMethod(
String s ){}
1
* Dummy Javadoc comment.
2
* @param
s a String
javaClassContent
- not nullentity
- not nulljava.io.IOException
- if anyprivate static java.lang.String removeLastEmptyJavadocLines(java.lang.String content) throws java.io.IOException
content
- not null *
)java.io.IOException
- if anygetJavadocComment(String, JavaAnnotatedElement, DocletTag)
private static java.lang.String alignIndentationJavadocLines(java.lang.String content, java.lang.String indent) throws java.io.IOException
content
- not nulljava.io.IOException
- if anygetJavadocComment(String, JavaAnnotatedElement, DocletTag)
private static java.lang.String autodetectIndentation(java.lang.String line)
autodetectIndentation( null ) = ""; autodetectIndentation( "a" ) = ""; autodetectIndentation( " a" ) = " "; autodetectIndentation( "\ta" ) = "\t";
line
- not nullprivate static java.lang.String[] getLines(java.lang.String content) throws java.io.IOException
content
- not nulljava.io.IOException
- if anyprivate static java.lang.String trimLeft(java.lang.String text)
trimLeft( null ) = ""; trimLeft( " " ) = ""; trimLeft( "a" ) = "a"; trimLeft( " a" ) = "a"; trimLeft( "\ta" ) = "a"; trimLeft( " a " ) = "a ";
text
- private static java.lang.String trimRight(java.lang.String text)
trimRight( null ) = ""; trimRight( " " ) = ""; trimRight( "a" ) = "a"; trimRight( "a\t" ) = "a"; trimRight( " a " ) = " a";
text
-