Package edu.umd.cs.findbugs
Class StringAnnotation
- java.lang.Object
-
- edu.umd.cs.findbugs.StringAnnotation
-
- All Implemented Interfaces:
BugAnnotation
,XMLWriteable
,XMLWriteableWithMessages
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<BugAnnotation>
public class StringAnnotation extends java.lang.Object implements BugAnnotation
Bug annotation class for string values.- Author:
- William Pugh
- See Also:
BugAnnotation
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_ROLE
static java.lang.String
ERROR_MSG_ROLE
static java.lang.String
FORMAT_SPECIFIER_ROLE
static java.lang.String
FORMAT_STRING_ROLE
static java.lang.String
PARAMETER_NAME_ROLE
static java.lang.String
REGEX_ROLE
static java.lang.String
REMAINING_OBLIGATIONS_ROLE
static java.lang.String
STRING_CONSTANT_ROLE
static java.lang.String
STRING_MESSAGE
static java.lang.String
STRING_NONSTRING_CONSTANT_ROLE
Used for non-string constants (e.g., null)static java.lang.String
TYPE_QUALIFIER_ROLE
-
Fields inherited from interface edu.umd.cs.findbugs.BugAnnotation
MESSAGE_TAG
-
-
Constructor Summary
Constructors Constructor Description StringAnnotation(java.lang.String value)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(BugAnnotationVisitor visitor)
Accept a BugAnnotationVisitor.java.lang.Object
clone()
int
compareTo(BugAnnotation o)
boolean
equals(java.lang.Object o)
java.lang.String
format(java.lang.String key, ClassAnnotation primaryClass)
Format the annotation as a String.static StringAnnotation
fromRawString(java.lang.String value)
static StringAnnotation
fromXMLEscapedString(java.lang.String value)
java.lang.String
getDescription()
Get a description of this bug annotation.java.lang.String
getValue()
Get the String value.int
hashCode()
boolean
isSignificant()
Is this annotation used to compute instance hashes or match bug instances across versionsvoid
setDescription(java.lang.String description)
Set a description of this bug annotation.java.lang.String
toString()
java.lang.String
toString(ClassAnnotation primaryClass)
void
writeXML(XMLOutput xmlOutput)
Write this object to given XMLOutput.void
writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary)
-
-
-
Field Detail
-
DEFAULT_ROLE
public static final java.lang.String DEFAULT_ROLE
- See Also:
- Constant Field Values
-
STRING_CONSTANT_ROLE
public static final java.lang.String STRING_CONSTANT_ROLE
- See Also:
- Constant Field Values
-
STRING_NONSTRING_CONSTANT_ROLE
public static final java.lang.String STRING_NONSTRING_CONSTANT_ROLE
Used for non-string constants (e.g., null)- See Also:
- Constant Field Values
-
REGEX_ROLE
public static final java.lang.String REGEX_ROLE
- See Also:
- Constant Field Values
-
ERROR_MSG_ROLE
public static final java.lang.String ERROR_MSG_ROLE
- See Also:
- Constant Field Values
-
STRING_MESSAGE
public static final java.lang.String STRING_MESSAGE
- See Also:
- Constant Field Values
-
PARAMETER_NAME_ROLE
public static final java.lang.String PARAMETER_NAME_ROLE
- See Also:
- Constant Field Values
-
TYPE_QUALIFIER_ROLE
public static final java.lang.String TYPE_QUALIFIER_ROLE
- See Also:
- Constant Field Values
-
REMAINING_OBLIGATIONS_ROLE
public static final java.lang.String REMAINING_OBLIGATIONS_ROLE
- See Also:
- Constant Field Values
-
FORMAT_STRING_ROLE
public static final java.lang.String FORMAT_STRING_ROLE
- See Also:
- Constant Field Values
-
FORMAT_SPECIFIER_ROLE
public static final java.lang.String FORMAT_SPECIFIER_ROLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
fromRawString
public static StringAnnotation fromRawString(java.lang.String value)
-
fromXMLEscapedString
public static StringAnnotation fromXMLEscapedString(java.lang.String value)
-
clone
public java.lang.Object clone()
- Specified by:
clone
in interfaceBugAnnotation
- Overrides:
clone
in classjava.lang.Object
-
getValue
public java.lang.String getValue()
Get the String value.- Returns:
- the String value
-
accept
public void accept(BugAnnotationVisitor visitor)
Description copied from interface:BugAnnotation
Accept a BugAnnotationVisitor.- Specified by:
accept
in interfaceBugAnnotation
- Parameters:
visitor
- the visitor to accept
-
format
public java.lang.String format(java.lang.String key, ClassAnnotation primaryClass)
Description copied from interface:BugAnnotation
Format 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:
format
in 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
public void setDescription(java.lang.String description)
Description copied from interface:BugAnnotation
Set a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.- Specified by:
setDescription
in interfaceBugAnnotation
-
getDescription
public java.lang.String getDescription()
Description copied from interface:BugAnnotation
Get a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.- Specified by:
getDescription
in interfaceBugAnnotation
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(BugAnnotation o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<BugAnnotation>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
writeXML
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
Description copied from interface:XMLWriteable
Write this object to given XMLOutput.- Specified by:
writeXML
in interfaceXMLWriteable
- Parameters:
xmlOutput
- the XMLOutput for the document- Throws:
java.io.IOException
-
writeXML
public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws java.io.IOException
- Specified by:
writeXML
in interfaceXMLWriteableWithMessages
- Throws:
java.io.IOException
-
isSignificant
public boolean isSignificant()
Description copied from interface:BugAnnotation
Is this annotation used to compute instance hashes or match bug instances across versions- Specified by:
isSignificant
in interfaceBugAnnotation
- Returns:
- true if significant
-
toString
public java.lang.String toString(ClassAnnotation primaryClass)
- Specified by:
toString
in interfaceBugAnnotation
-
-