1 2 12 package com.versant.core.jdo.tools.enhancer.info; 13 14 import com.versant.lib.bcel.generic.Type; 15 16 17 import com.versant.core.metadata.MDStatics; 18 19 import javax.jdo.spi.PersistenceCapable; 20 23 public class FieldInfo implements Comparable { 24 25 private String jdoSetName; 26 private String jdoGetName; 27 private String returnType; 28 private String fieldName; 29 private String className; 30 private String primativeTypeObject; 31 private String signature; 32 private Type type; 33 private int fieldNo; 34 private int persistenceModifier; 35 private boolean primaryKey; 36 private boolean defaultFetchGroup; 37 private boolean isPublic; 38 private boolean isPrivate; 39 private boolean isProtected; 40 private boolean isArray; 41 private boolean isPrimative; 42 43 44 45 46 public FieldInfo() {} 47 48 49 public int getFieldNo() { 50 return fieldNo; 51 } 52 53 public void setFieldNo(int fieldNo) { 54 this.fieldNo = fieldNo; 55 } 56 57 public String getClassName() { 58 return className; 59 } 60 61 public void setClassName(String className) { 62 this.className = className; 63 } 64 65 66 67 public void setSignature(String signature){ 68 this.signature = signature; 69 } 70 71 72 public String getSignature(){ 73 return signature; 74 } 75 76 public void setType(Type type){ 77 this.type = type; 78 } 79 public Type getType(){ 80 return type; 81 } 82 83 public byte getFlag(){ 84 if (persistenceModifier == MDStatics.PERSISTENCE_MODIFIER_TRANSACTIONAL){ 85 return PersistenceCapable.CHECK_WRITE; 86 } else if (primaryKey){ 87 return PersistenceCapable.MEDIATE_WRITE; 88 } else if (defaultFetchGroup){ 89 return PersistenceCapable.CHECK_READ + PersistenceCapable.CHECK_WRITE; 90 } else { 91 return PersistenceCapable.MEDIATE_READ + PersistenceCapable.MEDIATE_WRITE; 92 } 93 } 94 95 99 public int compareTo(Object o){ 100 FieldInfo other = (FieldInfo)o; 101 return fieldName.compareTo(other.getFieldName()); 102 } 103 104 public boolean equals(Object other){ 105 if (other != null && getClass() == other.getClass()){ 106 FieldInfo otherFieldInfo = (FieldInfo)other; 107 return fieldName.equals(otherFieldInfo.getFieldName()); 108 } else { 109 return false; 110 } 111 } 112 113 public int hashCode(){ 114 return 13 * fieldName.hashCode(); 115 } 116 119 public String getJdoSetName(){ 120 return jdoSetName; 121 } 122 125 public void setJdoSetName(String jdoSetName){ 126 this.jdoSetName = jdoSetName; 127 } 128 131 public String getJdoGetName(){ 132 return jdoGetName; 133 } 134 137 public void setJdoGetName(String jdoGetName){ 138 this.jdoGetName = jdoGetName; 139 } 140 143 public String getReturnType(){ 144 return returnType; 145 } 146 149 public void setReturnType(String returnType){ 150 this.returnType = returnType; 151 } 152 155 public String getFieldName(){ 156 return fieldName; 157 } 158 161 public void setFieldName(String fieldName){ 162 this.fieldName = fieldName; 163 } 164 165 168 public int getPersistenceModifier(){ 169 return persistenceModifier; 170 } 171 174 public void setPersistenceModifier(int persistenceModifier){ 175 this.persistenceModifier = persistenceModifier; 176 } 177 178 181 public void primaryKey(boolean primaryKey){ 182 this.primaryKey = primaryKey; 183 } 184 187 public boolean primaryKey(){ 188 return primaryKey; 189 } 190 193 public void defaultFetchGroup(boolean defaultFetchGroup){ 194 this.defaultFetchGroup = defaultFetchGroup; 195 } 196 197 198 201 public void isPublic(boolean isPublic){ 202 this.isPublic = isPublic; 203 } 204 207 public boolean isPublic(){ 208 return isPublic; 209 } 210 213 public void isPrivate(boolean isPrivate){ 214 this.isPrivate = isPrivate; 215 } 216 219 public boolean isPrivate(){ 220 return isPrivate; 221 } 222 225 public void isProtected(boolean isProtected){ 226 this.isProtected = isProtected; 227 } 228 231 public boolean isProtected(){ 232 return isProtected; 233 } 234 237 public void isArray(boolean isArray){ 238 this.isArray = isArray; 239 } 240 243 public boolean isArray(){ 244 return isArray; 245 } 246 249 public void isPrimative(boolean isPrimative){ 250 this.isPrimative = isPrimative; 251 } 252 255 public boolean isPrimative(){ 256 return isPrimative; 257 } 258 259 262 public void setPrimativeTypeObject(String primativeTypeObject){ 263 this.primativeTypeObject = primativeTypeObject; 264 } 265 268 public String getPrimativeTypeObject(){ 269 return primativeTypeObject; 270 } 271 272 public String toString(){ 273 return "\n************ Field "+fieldName+"************\n"+ 274 "jdoSetName = "+jdoSetName+"\n"+ 275 "jdoGetName = "+jdoGetName+"\n"+ 276 "returnType = "+returnType+"\n"+ 277 "fieldName = "+fieldName+"\n"+ 278 "persistenceModifier = "+persistenceModifier+"\n"+ 279 "primaryKey = "+primaryKey+"\n"+ 280 "defaultFetchGroup = "+(primaryKey ? false : defaultFetchGroup)+"\n"+ 281 "primativeTypeObject = "+primativeTypeObject+"\n"+ 282 "isPublic = "+isPublic+"\n"+ 283 "isPrivate = "+isPrivate+"\n"+ 284 "isProtected = "+isProtected+"\n"+ 285 "isArray = "+isArray+"\n"+ 286 "isPrimative = "+isPrimative+"\n"+ 287 "Type = "+type+"\n"+ 288 "*********************************************\n"; 289 } 290 291 } 292 | Popular Tags |