Class HelpMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- de.jpdigital.hibernate62_ddl_maven_plugin.HelpMojo
-
- All Implemented Interfaces:
ContextEnabled,Mojo
@Mojo(name="help", requiresProject=false, threadSafe=true) public class HelpMojo extends AbstractMojo
Display help information on hibernate62-ddl-maven-plugin.
Callmvn hibernate62-ddl:help -Ddetail=true -Dgoal=<goal-name>to display parameter details.- Author:
- maven-plugin-tools
-
-
Field Summary
Fields Modifier and Type Field Description private static intDEFAULT_LINE_LENGTHprivate booleandetailIftrue, display all settable properties for each goal.private StringgoalThe name of the goal for which to show help.private intindentSizeThe number of spaces per indentation level, should be positive.private intlineLengthThe maximum length of a display line, should be positive.private static StringPLUGIN_HELP_PATH
-
Constructor Summary
Constructors Constructor Description HelpMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidappend(StringBuilder sb, String description, int indent)Append a description to the buffer by respecting the indentSize and lineLength parameters.private Documentbuild()voidexecute()private static List<Node>findNamedChild(Node node, String elementName)private static NodefindSingleChild(Node node, String elementName)private static intgetIndentLevel(String line)Gets the indentation level of the specified line.private static StringgetPropertyFromExpression(String expression)private static NodegetSingleChild(Node node, String elementName)private static StringgetValue(Node node, String elementName)private static booleanisNotEmpty(String string)private static Stringrepeat(String str, int repeat)Repeat a Stringntimes to form a new string.private static List<String>toLines(String text, int indent, int indentSize, int lineLength)Splits the specified text into lines of convenient display length.private static voidtoLines(List<String> lines, String line, int indentSize, int lineLength)Adds the specified line to the output sequence, performing line wrapping if necessary.private voidwriteGoal(StringBuilder sb, String goalPrefix, Element mojo)private voidwriteParameter(StringBuilder sb, Node parameter, Node configurationElement)-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
detail
@Parameter(property="detail", defaultValue="false") private boolean detail
Iftrue, display all settable properties for each goal.
-
goal
@Parameter(property="goal") private String goal
The name of the goal for which to show help. If unspecified, all goals will be displayed.
-
lineLength
@Parameter(property="lineLength", defaultValue="80") private int lineLength
The maximum length of a display line, should be positive.
-
indentSize
@Parameter(property="indentSize", defaultValue="2") private int indentSize
The number of spaces per indentation level, should be positive.
-
PLUGIN_HELP_PATH
private static final String PLUGIN_HELP_PATH
- See Also:
- Constant Field Values
-
DEFAULT_LINE_LENGTH
private static final int DEFAULT_LINE_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
build
private Document build() throws MojoExecutionException
- Throws:
MojoExecutionException
-
execute
public void execute() throws MojoExecutionException- Throws:
MojoExecutionException
-
isNotEmpty
private static boolean isNotEmpty(String string)
-
getValue
private static String getValue(Node node, String elementName) throws MojoExecutionException
- Throws:
MojoExecutionException
-
getSingleChild
private static Node getSingleChild(Node node, String elementName) throws MojoExecutionException
- Throws:
MojoExecutionException
-
findSingleChild
private static Node findSingleChild(Node node, String elementName) throws MojoExecutionException
- Throws:
MojoExecutionException
-
writeGoal
private void writeGoal(StringBuilder sb, String goalPrefix, Element mojo) throws MojoExecutionException
- Throws:
MojoExecutionException
-
writeParameter
private void writeParameter(StringBuilder sb, Node parameter, Node configurationElement) throws MojoExecutionException
- Throws:
MojoExecutionException
-
repeat
private static String repeat(String str, int repeat)
Repeat a String
ntimes to form a new string.- Parameters:
str- String to repeatrepeat- number of times to repeat str- Returns:
- String with repeated String
- Throws:
NegativeArraySizeException- ifrepeat < 0NullPointerException- if str isnull
-
append
private void append(StringBuilder sb, String description, int indent)
Append a description to the buffer by respecting the indentSize and lineLength parameters. Note: The last character is always a new line.- Parameters:
sb- The buffer to append the description, notnull.description- The description, notnull.indent- The base indentation level of each line, must not be negative.
-
toLines
private static List<String> toLines(String text, int indent, int indentSize, int lineLength)
Splits the specified text into lines of convenient display length.- Parameters:
text- The text to split into lines, must not benull.indent- The base indentation level of each line, must not be negative.indentSize- The size of each indentation, must not be negative.lineLength- The length of the line, must not be negative.- Returns:
- The sequence of display lines, never
null. - Throws:
NegativeArraySizeException- ifindent < 0
-
toLines
private static void toLines(List<String> lines, String line, int indentSize, int lineLength)
Adds the specified line to the output sequence, performing line wrapping if necessary.- Parameters:
lines- The sequence of display lines, must not benull.line- The line to add, must not benull.indentSize- The size of each indentation, must not be negative.lineLength- The length of the line, must not be negative.
-
getIndentLevel
private static int getIndentLevel(String line)
Gets the indentation level of the specified line.- Parameters:
line- The line whose indentation level should be retrieved, must not benull.- Returns:
- The indentation level of the line.
-
-