1 package org.apache.turbine.services.intake.xmlmodel; 2 3 18 19 import java.io.Serializable ; 20 21 import org.apache.turbine.services.intake.validator.Constraint; 22 23 import org.xml.sax.Attributes ; 24 25 31 public class Rule 32 implements Constraint, Serializable 33 { 34 private String name; 35 private String value; 36 private String message; 37 private XmlField parent; 38 39 42 public Rule() 43 { 44 } 45 46 49 public void loadFromXML(Attributes attrib) 50 { 51 setName(attrib.getValue("name")); 52 setValue(attrib.getValue("value")); 53 } 54 55 58 public void setName(String newName) 59 { 60 name = newName; 61 } 62 63 66 public String getName() 67 { 68 return name; 69 } 70 71 74 public void setValue(String newValue) 75 { 76 value = newValue; 77 } 78 79 82 public String getValue() 83 { 84 return value; 85 } 86 87 90 public void setMessage(String newMessage) 91 { 92 message = newMessage; 93 } 94 95 98 public String getMessage() 99 { 100 return message; 101 } 102 103 106 public void setField(XmlField parent) 107 { 108 this.parent = parent; 109 } 110 111 114 public XmlField getField() 115 { 116 return parent; 117 } 118 119 123 public String toString() 124 { 125 StringBuffer result = new StringBuffer (100); 126 127 result.append("<rule name=\"" + name + "\"") 128 .append(" value=\"" + value + "\""); 129 130 if (message == null) 131 { 132 result.append(" />\n"); 133 } 134 else 135 { 136 result.append(">") 137 .append(message) 138 .append("</rule>\n"); 139 } 140 141 return result.toString(); 142 } 143 144 } 145 146 147 148 | Popular Tags |