Class PropertiesMacro
java.lang.Object
org.apache.maven.doxia.macro.AbstractMacro
com.puppycrawl.tools.checkstyle.site.PropertiesMacro
- All Implemented Interfaces:
- org.apache.maven.doxia.logging.LogEnabled,- org.apache.maven.doxia.macro.Macro
@Component(role=org.apache.maven.doxia.macro.Macro.class,
           hint="properties")
public class PropertiesMacro
extends org.apache.maven.doxia.macro.AbstractMacro
A macro that inserts a table of properties for the given checkstyle module.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate static final StringReflects end of a code segment.private static final StringReflects start of a code segment.private static final PatternThe precompiled pattern for a comma followed by a space.private static final StringThe string '{}'.private static StringThe name of the current module being processed.private static PathThe file of the current module being processed.static final StringConstant value for cases when tokens set is empty.private static final StringThe string '#'.private static final StringRepresents the relative path to the property types XML.private static final StringThis property is used to change the existing properties for javadoc.private static final StringRepresents the format string for constructing URLs with two placeholders.Fields inherited from interface org.apache.maven.doxia.macro.MacroEOL, ROLE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprivate static voidconfigureGlobalProperties(String modulePath) Configures the global properties for the current module.voidexecute(org.apache.maven.doxia.sink.Sink sink, org.apache.maven.doxia.macro.MacroRequest request) private static StringgetDefaultValue(String propertyName, Field field, Object instance) Get the default value of the property.orderProperties(Set<String> properties) Reorder properties to always have the 'tokens' property last (if present).private static voidprocessLinkForTokenTypes(org.apache.maven.doxia.sink.Sink sink) Writes a formatted link for "TokenTypes" to the given sink.private static voidwriteLink(org.apache.maven.doxia.sink.Sink sink) Write a link when all types of token supported.private static voidwriteLinkToToken(org.apache.maven.doxia.sink.Sink sink, String document, String tokenName) Writes a link to the given token.private static voidwritePropertiesTable(org.apache.maven.doxia.module.xdoc.XdocSink sink) Writes the properties table for the given module.private static voidwritePropertyDefaultValueCell(org.apache.maven.doxia.sink.Sink sink, String propertyName, Field field, Object instance) Writes a table cell with the property default value.private static voidwritePropertyDescriptionCell(org.apache.maven.doxia.sink.Sink sink, String propertyName, DetailNode propertyJavadoc) Writes a table cell with the property description.private static voidwritePropertyNameCell(org.apache.maven.doxia.sink.Sink sink, String propertyName) Writes a table cell with the given property name.private static voidwritePropertyRow(org.apache.maven.doxia.sink.Sink sink, String propertyName, DetailNode propertyJavadoc, Object instance, DetailNode moduleJavadoc) Writes a table row with 5 columns for the given property - name, description, type, default value, since.private static voidwritePropertySinceVersionCell(org.apache.maven.doxia.sink.Sink sink, DetailNode moduleJavadoc, DetailNode propertyJavadoc) Writes a table cell with the property since version.private static voidwritePropertyTypeCell(org.apache.maven.doxia.sink.Sink sink, String propertyName, Field field, Object instance) Writes a table cell with the property type.private static voidwriteTableHeaderCell(org.apache.maven.doxia.sink.Sink sink, String text) Writes a table header cell with the given text.private static voidwriteTableHeaderRow(org.apache.maven.doxia.sink.Sink sink) Writes the table header row with 5 columns - name, description, type, default value, since.private static voidwriteTablePropertiesRows(org.apache.maven.doxia.sink.Sink sink) Writes the rows of the table with the 5 columns - name, description, type, default value, since.private static voidwriteTokensList(org.apache.maven.doxia.sink.Sink sink, List<String> tokens, String tokenTypesLink, boolean printDotAtTheEnd) Write a list of tokens with links to the tokenTypesLink file.Methods inherited from class org.apache.maven.doxia.macro.AbstractMacroenableLogging, getAttributesFromMap, getLog, required
- 
Field Details- 
EMPTYConstant value for cases when tokens set is empty.- See Also:
 
- 
COMMA_SPACE_PATTERNThe precompiled pattern for a comma followed by a space.
- 
CURLY_BRACKETThe string '{}'.- See Also:
 
- 
PROPERTY_TYPES_XMLRepresents the relative path to the property types XML.- See Also:
 
- 
HASHTAGThe string '#'.- See Also:
 
- 
URL_FRepresents the format string for constructing URLs with two placeholders.- See Also:
 
- 
CODE_STARTReflects start of a code segment.- See Also:
 
- 
CODE_ENDReflects end of a code segment.- See Also:
 
- 
TOKENS_PROPERTYThis property is used to change the existing properties for javadoc. Tokens always present at the end of all properties.- See Also:
 
- 
currentModuleNameThe name of the current module being processed.
- 
currentModulePathThe file of the current module being processed.
 
- 
- 
Constructor Details- 
PropertiesMacropublic PropertiesMacro()
 
- 
- 
Method Details- 
executepublic void execute(org.apache.maven.doxia.sink.Sink sink, org.apache.maven.doxia.macro.MacroRequest request) throws org.apache.maven.doxia.macro.MacroExecutionException - Throws:
- org.apache.maven.doxia.macro.MacroExecutionException
 
- 
configureGlobalPropertiesprivate static void configureGlobalProperties(String modulePath) throws org.apache.maven.doxia.macro.MacroExecutionException Configures the global properties for the current module.- Parameters:
- modulePath- the path of the current module processed.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if the module path is invalid.
 
- 
writePropertiesTableprivate static void writePropertiesTable(org.apache.maven.doxia.module.xdoc.XdocSink sink) throws org.apache.maven.doxia.macro.MacroExecutionException Writes the properties table for the given module. Expects that the module has been processed with the ClassAndPropertiesSettersJavadocScraper before calling this method.- Parameters:
- sink- the sink to write to.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if an error occurs during writing.
 
- 
writeTableHeaderRowWrites the table header row with 5 columns - name, description, type, default value, since.- Parameters:
- sink- sink to write to.
 
- 
writeTableHeaderCellWrites a table header cell with the given text.- Parameters:
- sink- sink to write to.
- text- the text to write.
 
- 
writeTablePropertiesRowsprivate static void writeTablePropertiesRows(org.apache.maven.doxia.sink.Sink sink) throws org.apache.maven.doxia.macro.MacroExecutionException Writes the rows of the table with the 5 columns - name, description, type, default value, since. Each row corresponds to a property of the module.- Parameters:
- sink- sink to write to.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if an error occurs during writing.
 
- 
orderPropertiesReorder properties to always have the 'tokens' property last (if present).- Parameters:
- properties- module properties.
- Returns:
- Collection of ordered properties.
 
- 
writePropertyRowprivate static void writePropertyRow(org.apache.maven.doxia.sink.Sink sink, String propertyName, DetailNode propertyJavadoc, Object instance, DetailNode moduleJavadoc) throws org.apache.maven.doxia.macro.MacroExecutionException Writes a table row with 5 columns for the given property - name, description, type, default value, since.- Parameters:
- sink- sink to write to.
- propertyName- the name of the property.
- propertyJavadoc- the Javadoc of the property.
- instance- the instance of the module.
- moduleJavadoc- the Javadoc of the module.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if an error occurs during writing.
 
- 
writePropertyNameCellprivate static void writePropertyNameCell(org.apache.maven.doxia.sink.Sink sink, String propertyName) Writes a table cell with the given property name.- Parameters:
- sink- sink to write to.
- propertyName- the name of the property.
 
- 
writePropertyDescriptionCellprivate static void writePropertyDescriptionCell(org.apache.maven.doxia.sink.Sink sink, String propertyName, DetailNode propertyJavadoc) throws org.apache.maven.doxia.macro.MacroExecutionException Writes a table cell with the property description.- Parameters:
- sink- sink to write to.
- propertyName- the name of the property.
- propertyJavadoc- the Javadoc of the property containing the description.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if an error occurs during retrieval of the description.
 
- 
writePropertyTypeCellprivate static void writePropertyTypeCell(org.apache.maven.doxia.sink.Sink sink, String propertyName, Field field, Object instance) throws org.apache.maven.doxia.macro.MacroExecutionException Writes a table cell with the property type.- Parameters:
- sink- sink to write to.
- propertyName- the name of the property.
- field- the field of the property.
- instance- the instance of the module.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if link to the property_types.html file cannot be constructed.
 
- 
processLinkForTokenTypesprivate static void processLinkForTokenTypes(org.apache.maven.doxia.sink.Sink sink) throws org.apache.maven.doxia.macro.MacroExecutionException Writes a formatted link for "TokenTypes" to the given sink.- Parameters:
- sink- The output target where the link is written.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- If an error occurs during the link processing.
 
- 
writeLinkprivate static void writeLink(org.apache.maven.doxia.sink.Sink sink) throws org.apache.maven.doxia.macro.MacroExecutionException Write a link when all types of token supported.- Parameters:
- sink- sink to write to.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if link cannot be constructed.
 
- 
writeTokensListprivate static void writeTokensList(org.apache.maven.doxia.sink.Sink sink, List<String> tokens, String tokenTypesLink, boolean printDotAtTheEnd) throws org.apache.maven.doxia.macro.MacroExecutionException Write a list of tokens with links to the tokenTypesLink file.- Parameters:
- sink- sink to write to.
- tokens- the list of tokens to write.
- tokenTypesLink- the link to the token types file.
- printDotAtTheEnd- defines if printing period symbols is required.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if link to the tokenTypesLink file cannot be constructed.
 
- 
writeLinkToTokenprivate static void writeLinkToToken(org.apache.maven.doxia.sink.Sink sink, String document, String tokenName) throws org.apache.maven.doxia.macro.MacroExecutionException Writes a link to the given token.- Parameters:
- sink- sink to write to.
- document- the document to link to.
- tokenName- the name of the token.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if link to the document file cannot be constructed.
 
- 
writePropertyDefaultValueCellprivate static void writePropertyDefaultValueCell(org.apache.maven.doxia.sink.Sink sink, String propertyName, Field field, Object instance) throws org.apache.maven.doxia.macro.MacroExecutionException Writes a table cell with the property default value.- Parameters:
- sink- sink to write to.
- propertyName- the name of the property.
- field- the field of the property.
- instance- the instance of the module.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if an error occurs during retrieval of the default value.
 
- 
getDefaultValueprivate static String getDefaultValue(String propertyName, Field field, Object instance) throws org.apache.maven.doxia.macro.MacroExecutionException Get the default value of the property.- Parameters:
- propertyName- the name of the property.
- field- the field of the property.
- instance- the instance of the module.
- Returns:
- the default value of the property.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if an error occurs during retrieval of the default value.
 
- 
writePropertySinceVersionCellprivate static void writePropertySinceVersionCell(org.apache.maven.doxia.sink.Sink sink, DetailNode moduleJavadoc, DetailNode propertyJavadoc) throws org.apache.maven.doxia.macro.MacroExecutionException Writes a table cell with the property since version.- Parameters:
- sink- sink to write to.
- moduleJavadoc- the Javadoc of the module.
- propertyJavadoc- the Javadoc of the property containing the since version.
- Throws:
- org.apache.maven.doxia.macro.MacroExecutionException- if an error occurs during retrieval of the since version.
 
 
-