1 19 package org.enhydra.zeus.binding; 20 21 import java.util.BitSet ; 22 import java.util.Vector ; 23 24 import org.enhydra.zeus.Binding; 26 27 44 public abstract class BaseProperty extends BaseBinding implements Property { 45 46 47 protected BitSet modifier; 48 49 50 protected boolean isCollection; 51 52 53 protected Object defaultValue; 54 55 56 protected Vector enumeration; 57 58 63 public void BaseProperty() { 64 this.isCollection = false; 65 this.modifier = new BitSet (); 66 this.defaultValue = null; 67 this.enumeration = null; 68 } 69 70 93 public void setModifier(BitSet modifier) { 94 if (modifier == null) { 95 throw new IllegalArgumentException ("A Property cannot have a " + 96 "null set of modifiers."); 97 } 98 99 this.modifier = modifier; 100 } 101 102 122 public BitSet getModifier() { 123 return modifier; 124 } 125 126 142 public String getModifierString() { 143 StringBuffer modifierString = new StringBuffer (); 144 if (modifier.get(ACCESS_PRIVATE)) { 145 modifierString.append("private"); 146 } else if (modifier.get(ACCESS_PROTECTED)) { 147 modifierString.append("protected"); 148 } else if (modifier.get(ACCESS_PUBLIC)) { 149 modifierString.append("public"); 150 } else { 151 throw new UnsupportedOperationException 152 ("Modifier must set access modifiers."); 153 } 154 155 if (modifier.get(STORAGE_STATIC)) { 156 modifierString.append(" static"); 157 } 158 if (modifier.get(MUTABILITY_VOLATILE)) { 159 modifierString.append(" volatile"); 160 } else if (modifier.get(MUTABILITY_FINAL)) { 161 modifierString.append(" final"); 162 } 163 164 return modifierString.toString(); 165 } 166 167 178 public void setIsCollection(boolean isCollection) { 179 this.isCollection = isCollection; 180 } 181 182 193 public boolean isCollection() { 194 return isCollection; 195 } 196 197 205 public boolean hasDefaultValue() { 206 return (defaultValue != null); 207 } 208 209 241 public void setDefaultValue(Object defaultValue) { 242 this.defaultValue = defaultValue; 243 } 244 245 255 public Object getDefaultValue() { 256 return defaultValue; 257 } 258 259 267 public boolean hasEnumeration() { 268 return (enumeration != null); 269 } 270 271 280 public void setEnumeration(Vector enumeration) { 281 this.enumeration = enumeration; 282 } 283 284 292 public Vector getEnumeration() { 293 return enumeration; 294 } 295 } 296 | Popular Tags |