Class Comment
- Direct Known Subclasses:
AvoidBooleanLiteralReturns
,AvoidComparisonWithLiteral
,AvoidHardCodedTestCases
,AvoidIfStatements
,AvoidPrintStatements
,ConstructorTooLong
,DoNotUseMainMethod
,ExemplarSolution
,FeedbackRequest
,MethodTooLong
,PreferStringConcatenation
,RedundantParentheses
,RemoveTodoComments
,ReuseCode
Comment
class models a single comment in the analysis output.
Each comment has a unique key that translates to a Markdown template in the
exercism/website-copy repository.
If the Markdown template contains any parameters, classes inheriting from Comment
should override the
getParameters()
method to return the parameter keys and values specific to that template.
Override the getType()
method to change the Comment.Type
associated to the comment.
- See Also:
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
abstract String
getKey()
The comment key is aString
that uniquely identifies the comment.Each parameter in the Markdown template should have a corresponding parameter in the comment.getType()
UseComment.Type.ESSENTIAL
to instruct students that they must address it. UseComment.Type.ACTIONABLE
to instruct students that they could improve their solution by addressing it. UseComment.Type.INFORMATIVE
to give students extra information without expecting them to use it. UseComment.Type.CELEBRATORY
to tell students that they did something right.int
hashCode()
toString()
-
Constructor Details
-
Comment
public Comment()
-
-
Method Details
-
getKey
The comment key is aString
that uniquely identifies the comment.Comment keys use the format
"java.<scope>.<name>"
. The<scope>
can be eithergeneral
for general comments, or the slug of the exercise for exercise-specific comments. The<name>
specifies the name of the comment.The combination of
<scope>
and<name>
must be unique, and defines the location of the Markdown template in the exercism/website-copy repository.For example, the comment key
"java.hello-world.foo_bar"
would translate to the Markdown file atanalyzer-comments/java/hello-world/foo_bar.md
.- Returns:
- The unique comment key.
-
getParameters
Each parameter in the Markdown template should have a corresponding parameter in the comment. Parameters in Markdown templates are of the form%<parameterName>s
.For example, if the Markdown template contains a parameter
%<methodName>s
, the implementation of this method could look like this:public Map<String, String> getParameters() { return Map.of("methodName", "theNameOfTheMethod"); }
- Returns:
- The parameters for the comment.
-
getType
- Use
Comment.Type.ESSENTIAL
to instruct students that they must address it. - Use
Comment.Type.ACTIONABLE
to instruct students that they could improve their solution by addressing it. - Use
Comment.Type.INFORMATIVE
to give students extra information without expecting them to use it. - Use
Comment.Type.CELEBRATORY
to tell students that they did something right.
- Returns:
- The type of the comment.
- See Also:
- Use
-
equals
-
equals
-
hashCode
public int hashCode() -
toString
-