Example #1
0
 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];
 }
Example #2
0
 public void setToDefault() {
   // standard values for non-final fields
   this.isEnabled = true;
   this.severity = ProblemSeverity.fromCategory(category);
 }
Example #3
0
 public String serializeNonFinalFields() {
   StringBuffer serialization = new StringBuffer();
   serialization.append(isEnabled).append(DELIMITER);
   serialization.append(severity.ordinal()).append(DELIMITER);
   return serialization.toString();
 }