1 18 19 20 package org.apache.struts.config; 21 22 23 import java.io.Serializable ; 24 import org.apache.struts.Globals; 25 26 27 35 36 public class MessageResourcesConfig implements Serializable { 37 38 39 41 42 45 protected boolean configured = false; 46 47 48 50 51 55 protected String factory = 56 "org.apache.struts.util.PropertyMessageResourcesFactory"; 57 58 public String getFactory() { 59 return (this.factory); 60 } 61 62 public void setFactory(String factory) { 63 if (configured) { 64 throw new IllegalStateException ("Configuration is frozen"); 65 } 66 this.factory = factory; 67 } 68 69 70 74 protected String key = Globals.MESSAGES_KEY; 75 76 public String getKey() { 77 return (this.key); 78 } 79 80 public void setKey(String key) { 81 if (configured) { 82 throw new IllegalStateException ("Configuration is frozen"); 83 } 84 this.key = key; 85 } 86 87 88 91 protected boolean nullValue = true; 92 93 public boolean getNull() { 94 return (this.nullValue); 95 } 96 97 public void setNull(boolean nullValue) { 98 if (configured) { 99 throw new IllegalStateException ("Configuration is frozen"); 100 } 101 this.nullValue = nullValue; 102 } 103 104 105 109 protected String parameter = null; 110 111 public String getParameter() { 112 return (this.parameter); 113 } 114 115 public void setParameter(String parameter) { 116 if (configured) { 117 throw new IllegalStateException ("Configuration is frozen"); 118 } 119 this.parameter = parameter; 120 } 121 122 123 125 126 129 public void freeze() { 130 131 configured = true; 132 133 } 134 135 136 139 public String toString() { 140 141 StringBuffer sb = new StringBuffer ("MessageResourcesConfig["); 142 sb.append("factory="); 143 sb.append(this.factory); 144 sb.append(",null="); 145 sb.append(this.nullValue); 146 sb.append(",parameter="); 147 sb.append(this.parameter); 148 sb.append("]"); 149 return (sb.toString()); 150 151 } 152 153 154 } 155 | Popular Tags |