1 package org.apache.turbine.util; 2 3 18 19 import java.util.Vector ; 20 21 29 public class FormMessage 30 { 31 private String message; 32 private String formName; 33 private Vector fieldNames; 34 35 38 public FormMessage() 39 { 40 fieldNames = new Vector (); 41 } 42 43 48 public FormMessage(String formName) 49 { 50 this(); 51 setFormName(formName); 52 } 53 54 60 public FormMessage(String formName, 61 String fieldName) 62 { 63 this(formName); 64 setFieldName(fieldName); 65 } 66 67 74 public FormMessage(String formName, 75 String fieldName, 76 String message) 77 { 78 this(formName, fieldName); 79 setMessage(message); 80 } 81 82 87 public String getMessage() 88 { 89 return message; 90 } 91 92 97 public String getFormName() 98 { 99 return formName; 100 } 101 102 107 public String [] getFieldNames() 108 { 109 String [] result = new String [fieldNames.size()]; 110 fieldNames.copyInto(result); 111 return result; 112 } 113 114 119 public void setMessage(String message) 120 { 121 this.message = message; 122 } 123 124 129 public void setFormName(String formName) 130 { 131 this.formName = formName; 132 } 133 134 139 public void setFieldName(String fieldName) 140 { 141 fieldNames.addElement(fieldName); 142 } 143 144 148 public String toString() 149 { 150 StringBuffer sb = new StringBuffer ("formName:" + getFormName() + ", fieldNames:"); 151 for (int i = 0; i< getFieldNames().length; i++){ 152 sb.append(getFieldNames()[i] + " "); 153 } 154 sb.append(", message:" + getMessage()); 155 156 return sb.toString(); 157 } 158 } 159 | Popular Tags |