1 27 28 package org.objectweb.speedo.metadata; 29 30 import org.objectweb.asm.Constants; 31 import org.objectweb.asm.Type; 32 import org.objectweb.speedo.generation.enhancer.Util; 33 34 38 public class SpeedoField extends SpeedoElement { 39 40 public final static byte NO_RELATION = 0; 41 public final static byte ONE_ONE_RELATION = 1; 42 public final static byte ONE_MANY_RELATION = 2; 43 public final static byte MANY_ONE_RELATION = 3; 44 public final static byte MANY_MANY_RELATION = 4; 45 46 49 public String name; 50 51 54 public int access; 55 56 59 public String desc; 60 61 65 public int number = -1; 66 67 70 public byte persistenceModifier = SpeedoModifier.missing; 71 72 75 public boolean primaryKey = false; 76 77 80 public byte nullValue = SpeedoNullValue.NONE; 81 82 86 public boolean defaultFetchGroup = true; 87 88 92 public int depth = 0; 93 94 public String fetchGroup; 95 96 99 public boolean embedded = true; 100 101 104 public String valueStrategy; 105 106 109 public String sequence; 110 111 119 public byte relationType = NO_RELATION; 120 121 124 public SpeedoTuple jdoTuple; 125 126 129 public SpeedoClass jdoClass; 130 131 132 136 public String toString() { 137 String s = "\n field name : " + name + ", persistenceModifier : " 138 + persistenceModifier + ", primaryKey : " + primaryKey 139 + ", nullValue : " + nullValue + ", defaultFetchGroup : " 140 + defaultFetchGroup + ", embedded : " + embedded 141 + ", fetchGroup : " + fetchGroup + ", depth : " + depth 142 + ", valueStrategy : " + valueStrategy + " , sequence : " + sequence; 143 if (jdoTuple != null) 144 s = s + jdoTuple.toString(); 145 return s; 146 } 147 148 152 public String publicSignature() { 153 int publicAccess = access; 154 publicAccess &= ~(Constants.ACC_PRIVATE | Constants.ACC_PROTECTED); 155 publicAccess |= Constants.ACC_PUBLIC; 156 return Util.modifier(publicAccess) + type() + " " + name; 157 } 158 159 163 public String privateSignature() { 164 int privateAccess = access; 165 privateAccess &= ~(Constants.ACC_PUBLIC | Constants.ACC_PROTECTED); 166 privateAccess |= Constants.ACC_PRIVATE; 167 return Util.modifier(privateAccess) + type() + " " + name; 168 } 169 170 175 public String modifier() { 176 return Util.modifier(access); 177 } 178 179 183 public String type() { 184 return Util.type(Type.getType(desc)); 185 } 186 } 187 | Popular Tags |