1 20 21 package net.innig.macker.event; 22 23 import net.innig.macker.rule.Rule; 24 import net.innig.macker.rule.RuleSeverity; 25 26 import java.util.*; 27 28 public class MackerEvent 29 extends EventObject 30 { 31 public MackerEvent( 32 Rule rule, 33 String description, 34 List messages) 35 { 36 super(rule); 37 this.rule = rule; 38 this.description = description; 39 this.messages = Collections.unmodifiableList(new ArrayList(messages)); 40 } 41 42 public Rule getRule() 43 { return rule; } 44 45 public String getDescription() 46 { return description; } 47 48 public List getMessages() 49 { return messages; } 50 51 public String toString() 52 { return getDescription(); } 53 54 public String toStringVerbose() 55 { 56 final String CR = System.getProperty("line.separator"); 58 StringBuffer s = new StringBuffer (); 59 if(rule.getSeverity() != RuleSeverity.ERROR) 60 { 61 s.append(rule.getSeverity().getName().toUpperCase()); 62 s.append(": "); 63 } 64 for(Iterator i = messages.iterator(); i.hasNext(); ) 65 { 66 s.append(i.next().toString()); 67 s.append(CR); 68 } 69 if(getDescription() != null) 70 s.append(getDescription()); 71 s.append(CR); 72 return s.toString(); 73 } 74 75 private final Rule rule; 76 private final String description; 77 private final List messages; 78 } 79 80 | Popular Tags |