com.github.sevntu.checkstyle.checks.annotation.checkstyle-metadata.properties Maven / Gradle / Ivy
ForbidAnnotationCheck.name = Forbid Annotation
ForbidAnnotationCheck.desc = Forbid specific annotation of variable,methods,class,package and other.
ForbidAnnotationCheck.annotationNames = Set of annotation's names
ForbidAnnotationCheck.annotationTargets = Array of type forbidden annotation's target.
ForbidAnnotationElementValueCheck.name = Forbid Annotation Element Value
ForbidAnnotationElementValueCheck.desc = Forbids specific element value for specific annotation.
ForbidAnnotationElementValueCheck.annotationName = Annotation Name
ForbidAnnotationElementValueCheck.elementName = Element name. If you want forbid single-element annotation, specify this field as "value".
ForbidAnnotationElementValueCheck.forbiddenElementValueRegexp = Element value regular expression
RequiredParameterForAnnotationCheck.name = Required Parameters on Annotation
RequiredParameterForAnnotationCheck.desc = Check that annotation is used with all required parameters.
Parameters:
annotationName - The name of the target annotation where enforcement of parameter should happen.
requiredParameters - Set of parameter names that are required on the target annotation. Names can be specified on any order in target annotation.
Example 1.
Configuration:
<module name="RequiredParameterForAnnotation">
<property name="annotationName" value="TheAnnotation"/>
<property name="requiredParameters" value="ThePropertyName1"/>
</module>
Result:
{@literal @}TheAnnotation() //Violation. ThePropertyName1 missing.
someMethod() {}
{@literal @}TheAnnotation(ThePropertyName2=2) //Violation. ThePropertyName1 missing.
class SomeClass {}
{@literal @}TheAnnotation(ThePropertyName1=1) //Correct.
class SomeClass {}
{@literal @}TheAnnotation(ThePropertyName2=2, ThePropertyName3=3, ThePropertyName1=1) //Correct.
class SomeClass {}
Example 2.
Configuration:
<module name="RequiredParameterForAnnotation">
<property name="annotationName" value="TheAnnotation"/>
<property name="requiredParameters" value="ThePropertyName1,ThePropertyName2,ThePropertyName3"/>
</module>
Result:
{@literal @}TheAnnotation() //Violation. ThePropertyName1, ThePropertyName2, ThePropertyName3 missing.
someMethod() {}
{@literal @}TheAnnotation(ThePropertyName2=2) //Violation. ThePropertyName1, ThePropertyName3 missing.
class SomeClass {}
{@literal @}TheAnnotation(ThePropertyName3=3, ThePropertyName2=2, ThePropertyName1=1) //Correct.
class SomeClass {}
@author Andrew Uljanenko
RequiredParameterForAnnotationCheck.annotationName = The name of the target annotation where enforcement of parameter should happen.
RequiredParameterForAnnotationCheck.requiredParameters = Set of parameter names that are required on the target annotation. Names can be specified on any order in target annotation.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy