package com.ubx1.pdpscanner.shared;
import java.io.Serializable;
import com.ubx1.pdpscanner.client.FindbugsAbbrev;
import com.ubx1.pdpscanner.client.FindbugsType;
/**
* Represents a bug instance from a Findbugs report.
*
* @author wbraik
*
*/
public class FindbugsBugInstance implements Serializable {
private static final long serialVersionUID = 1L;
// Identification of the bug instance
private String category;
private String abbrev;
private String type;
// Location of the bug in the source code
private String file;
private int line;
public FindbugsBugInstance() {
}
public FindbugsBugInstance(String category, String abbrev, String type,
String file, int line) {
this.category = category;
this.abbrev = abbrev;
this.type = type;
this.file = file;
this.line = line;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getAbbrev() {
return abbrev;
}
public void setAbbrev(String abbrev) {
this.abbrev = abbrev;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getFile() {
return file;
}
public void setFile(String file) {
this.file = file;
}
public int getLine() {
return line;
}
public void setLine(int line) {
this.line = line;
}
public static String getAbbrevDescription(String abbrev) {
FindbugsAbbrev fbAbbrev = FindbugsAbbrev.valueOf(abbrev);
if (fbAbbrev != null) {
return fbAbbrev.description();
} else {
return null;
}
}
public static String getTypeDescription(String type) {
FindbugsType fbType = FindbugsType.valueOf(type);
if (fbType != null) {
return fbType.description();
} else {
return null;
}
}
@Override
public String toString() {
return "FindbugsStat [category=" + category + ", abbrev=" + abbrev
+ ", type=" + type + ", file=" + file + ", line=" + line + "]";
}
}