1 package xdoclet.modules.ojb.model; 2 3 17 18 23 public class FieldDescriptorDef extends FeatureDescriptorDef 24 { 25 26 private boolean _isAnonymous = false; 27 28 33 public FieldDescriptorDef(String name) 34 { 35 super(name); 36 } 37 38 44 public FieldDescriptorDef(FieldDescriptorDef src, String prefix) 45 { 46 super(src, prefix); 47 _isAnonymous = src._isAnonymous; 48 } 49 50 53 public void setAnonymous() 54 { 55 _isAnonymous = true; 56 } 57 58 63 public boolean isAnonymous() 64 { 65 return _isAnonymous; 66 } 67 68 73 public String getSizeConstraint() 74 { 75 String constraint = getProperty(PropertyHelper.OJB_PROPERTY_LENGTH); 76 77 if ((constraint == null) || (constraint.length() == 0)) 78 { 79 String precision = getProperty(PropertyHelper.OJB_PROPERTY_PRECISION); 80 String scale = getProperty(PropertyHelper.OJB_PROPERTY_SCALE); 81 82 if ((precision == null) || (precision.length() == 0)) 83 { 84 precision = getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_PRECISION); 85 } 86 if ((scale == null) || (scale.length() == 0)) 87 { 88 scale = getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_SCALE); 89 } 90 if (((precision != null) && (precision.length() > 0)) || 91 ((scale != null) && (scale.length() > 0))) 92 { 93 if ((precision == null) || (precision.length() == 0)) 94 { 95 precision = "1"; 96 } 97 if ((scale == null) || (scale.length() == 0)) 98 { 99 scale = "0"; 100 } 101 constraint = precision + "," + scale; 102 } 103 } 104 return constraint; 105 } 106 } 107 | Popular Tags |