1 19 20 package edu.umd.cs.findbugs; 21 22 import java.io.IOException ; 23 import java.io.Serializable ; 24 25 import edu.umd.cs.findbugs.xml.XMLAttributeList; 26 import edu.umd.cs.findbugs.xml.XMLOutput; 27 import edu.umd.cs.findbugs.xml.XMLWriteable; 28 29 36 public class BugProperty implements XMLWriteable, Serializable , Cloneable { 37 private static final long serialVersionUID = 1L; 38 39 41 42 public static final String IS_BUG = "isBug"; 43 44 45 public static final String SEVERITY = "severity"; 46 47 private String name; 49 private String value; 50 private BugProperty next; 51 52 58 BugProperty(String name, String value) { 59 this.name = name.intern(); 60 this.value = value; 61 } 62 63 @Override 65 protected Object clone() { 66 try { 67 return super.clone(); 68 } catch (CloneNotSupportedException e) { 69 throw new AssertionError (e); 70 } 71 } 72 73 78 public String getName() { 79 return name; 80 } 81 82 87 public String getValue() { 88 return value; 89 } 90 91 96 public boolean getValueAsBoolean() { 97 return Boolean.valueOf(getValue()).booleanValue(); 98 } 99 100 107 public int getValueAsInt() { 108 return Integer.parseInt(getValue()); 109 } 110 111 116 public void setValue(String value) { 117 this.value = value; 118 } 119 120 125 void setNext(BugProperty next) { 126 this.next = next; 127 } 128 129 134 BugProperty getNext() { 135 return next; 136 } 137 138 141 public void writeXML(XMLOutput xmlOutput) throws IOException { 142 xmlOutput.openCloseTag( 143 "Property", 144 new XMLAttributeList() 145 .addAttribute("name", getName()) 146 .addAttribute("value", getValue()) 147 ); 148 } 149 } 150 | Popular Tags |