Package edu.umd.cs.findbugs
Class StringAnnotation
java.lang.Object
edu.umd.cs.findbugs.StringAnnotation
- All Implemented Interfaces:
BugAnnotation,XMLWriteable,XMLWriteableWithMessages,Serializable,Cloneable,Comparable<BugAnnotation>
Bug annotation class for string values.
- Author:
- William Pugh
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringUsed for non-string constants (e.g., null)static final StringFields inherited from interface edu.umd.cs.findbugs.BugAnnotation
MESSAGE_TAG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(BugAnnotationVisitor visitor) Accept a BugAnnotationVisitor.clone()intbooleanformat(String key, ClassAnnotation primaryClass) Format the annotation as a String.static StringAnnotationfromRawString(String value) static StringAnnotationfromXMLEscapedString(String value) Get a description of this bug annotation.getValue()Get the String value.inthashCode()booleanIs this annotation used to compute instance hashes or match bug instances across versionsvoidsetDescription(String description) Set a description of this bug annotation.toString()toString(ClassAnnotation primaryClass) voidWrite this object to given XMLOutput.void
-
Field Details
-
DEFAULT_ROLE
- See Also:
-
STRING_CONSTANT_ROLE
- See Also:
-
STRING_NONSTRING_CONSTANT_ROLE
Used for non-string constants (e.g., null)- See Also:
-
REGEX_ROLE
- See Also:
-
ERROR_MSG_ROLE
- See Also:
-
STRING_MESSAGE
- See Also:
-
PARAMETER_NAME_ROLE
- See Also:
-
TYPE_QUALIFIER_ROLE
- See Also:
-
REMAINING_OBLIGATIONS_ROLE
- See Also:
-
FORMAT_STRING_ROLE
- See Also:
-
FORMAT_SPECIFIER_ROLE
- See Also:
-
-
Constructor Details
-
StringAnnotation
Constructor.- Parameters:
value- the String value
-
-
Method Details
-
fromRawString
-
fromXMLEscapedString
-
clone
- Specified by:
clonein interfaceBugAnnotation- Overrides:
clonein classObject
-
getValue
Get the String value.- Returns:
- the String value
-
accept
Description copied from interface:BugAnnotationAccept a BugAnnotationVisitor.- Specified by:
acceptin interfaceBugAnnotation- Parameters:
visitor- the visitor to accept
-
format
Description copied from interface:BugAnnotationFormat the annotation as a String. The given key specifies additional information about how the annotation should be formatted. If the key is empty, then the "default" format will be used.- Specified by:
formatin interfaceBugAnnotation- Parameters:
key- how the annotation should be formattedprimaryClass- The primary class for the bug; some bug annotation format msgs are simplified in relation to that class.
-
setDescription
Description copied from interface:BugAnnotationSet a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.- Specified by:
setDescriptionin interfaceBugAnnotation
-
getDescription
Description copied from interface:BugAnnotationGet a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.- Specified by:
getDescriptionin interfaceBugAnnotation
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<BugAnnotation>
-
toString
-
writeXML
Description copied from interface:XMLWriteableWrite this object to given XMLOutput.- Specified by:
writeXMLin interfaceXMLWriteable- Parameters:
xmlOutput- the XMLOutput for the document- Throws:
IOException
-
writeXML
public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException - Specified by:
writeXMLin interfaceXMLWriteableWithMessages- Throws:
IOException
-
isSignificant
public boolean isSignificant()Description copied from interface:BugAnnotationIs this annotation used to compute instance hashes or match bug instances across versions- Specified by:
isSignificantin interfaceBugAnnotation- Returns:
- true if significant
-
toString
- Specified by:
toStringin interfaceBugAnnotation
-