public void deserializeNonFinalFields(String serialization) throws NoSuchElementException, IllegalArgumentException { StringTokenizer tokenizer = new StringTokenizer(serialization, DELIMITER); String token = tokenizer.nextToken(); boolean isEnabled = Boolean.parseBoolean(token); token = tokenizer.nextToken(); int severity = Integer.parseInt(token); // range check for severity if (severity < IMarker.SEVERITY_INFO || severity > IMarker.SEVERITY_ERROR) { throw new IllegalArgumentException( "Found invalid severity value of " + String.valueOf(severity)); } this.isEnabled = isEnabled; this.severity = ProblemSeverity.values()[severity]; }
public void setToDefault() { // standard values for non-final fields this.isEnabled = true; this.severity = ProblemSeverity.fromCategory(category); }
public String serializeNonFinalFields() { StringBuffer serialization = new StringBuffer(); serialization.append(isEnabled).append(DELIMITER); serialization.append(severity.ordinal()).append(DELIMITER); return serialization.toString(); }