1 29 30 package com.caucho.amber.field; 31 32 import com.caucho.amber.expr.AmberExpr; 33 import com.caucho.amber.expr.PathExpr; 34 import com.caucho.amber.manager.AmberConnection; 35 import com.caucho.amber.manager.AmberPersistenceUnit; 36 import com.caucho.amber.query.QueryParser; 37 import com.caucho.amber.table.Table; 38 import com.caucho.amber.type.AbstractStatefulType; 39 import com.caucho.bytecode.JMethod; 40 import com.caucho.bytecode.JType; 41 import com.caucho.config.ConfigException; 42 import com.caucho.java.JavaWriter; 43 import com.caucho.util.CharBuffer; 44 45 import java.io.IOException ; 46 import java.io.Serializable ; 47 import java.sql.SQLException ; 48 import java.util.ArrayList ; 49 import java.util.HashSet ; 50 51 54 public interface AmberField { 55 58 public AbstractStatefulType getSourceType(); 59 60 63 public boolean isLazy(); 64 65 68 public String getName(); 69 70 73 public Table getTable(); 74 75 78 public int getIndex(); 79 80 83 public int getLoadGroupIndex(); 84 85 88 public long getCreateLoadMask(int group); 89 90 93 public JMethod getGetterMethod(); 94 95 98 public String getGetterName(); 99 100 103 public JType getJavaType(); 104 105 108 public String getJavaTypeName(); 109 110 113 public JMethod getSetterMethod(); 114 115 118 public String getSetterName(); 119 120 123 public boolean isAbstract(); 124 125 128 public boolean isCascadable(); 129 130 133 public boolean isUpdateable(); 134 135 138 public void setIndex(int index); 139 140 143 public void init() 144 throws ConfigException; 145 146 149 public String generateSuperGetter(); 150 151 154 public String generateSuperSetter(String value); 155 156 159 public void generatePrologue(JavaWriter out, HashSet <Object > completedSet) 160 throws IOException ; 161 162 165 public void generatePostConstructor(JavaWriter out) 166 throws IOException ; 167 168 171 public String generateLoadSelect(Table table, String id); 172 173 176 public String generateSelect(String id); 177 178 181 public String generateJavaSelect(String id); 182 183 186 public String generateWhere(String id); 187 188 191 public void generateUpdate(CharBuffer sql); 192 193 196 public void generateUpdate(JavaWriter out, String mask, String pstmt, 197 String index) 198 throws IOException ; 199 200 203 public boolean hasLoadGroup(int index); 204 205 208 public int generateLoad(JavaWriter out, String rs, 209 String indexVar, int loadGroupIndex) 210 throws IOException ; 211 212 215 public int generateLoadEager(JavaWriter out, String rs, 216 String indexVar, int index) 217 throws IOException ; 218 219 222 public void generateLoadFromObject(JavaWriter out, String obj) 223 throws IOException ; 224 225 228 public void generateSet(JavaWriter out, String obj) 229 throws IOException ; 230 231 234 public void generateUpdateFromObject(JavaWriter out, String obj) 235 throws IOException ; 236 237 242 public void generateGet(JavaWriter out, String value) 243 throws IOException ; 244 245 250 public String generateGet(String value); 251 252 257 public String generateSet(String obj, String value); 258 259 262 public void generateInsertColumns(ArrayList <String > columns); 263 264 267 public void generateGetProperty(JavaWriter out) 268 throws IOException ; 269 270 273 public void generateSetProperty(JavaWriter out) 274 throws IOException ; 275 276 279 public void generateSuperGetter(JavaWriter out) 280 throws IOException ; 281 282 285 public void generateSuperSetter(JavaWriter out) 286 throws IOException ; 287 288 291 public String generateCreateTableSQL(AmberPersistenceUnit manager); 292 293 296 public void generateSet(JavaWriter out, String pstmt, String index) 297 throws IOException ; 298 299 302 public void generateInsertSet(JavaWriter out, String pstmt, 303 String index, String obj) 304 throws IOException ; 305 306 309 public void generateUpdateSet(JavaWriter out, String pstmt, 310 String index, String obj) 311 throws IOException ; 312 313 316 public void generateCopyUpdateObject(JavaWriter out, 317 String dst, String src, 318 int updateIndex) 319 throws IOException ; 320 321 324 public void generateCopyLoadObject(JavaWriter out, 325 String dst, String src, 326 int loadIndex) 327 throws IOException ; 328 329 332 public void generateSet(JavaWriter out, String pstmt, 333 String index, String obj) 334 throws IOException ; 335 336 339 public String toObject(String value); 340 341 344 public void link(); 345 346 349 public void generatePreDelete(JavaWriter out) 350 throws IOException ; 351 352 355 public void generatePostDelete(JavaWriter out) 356 throws IOException ; 357 358 361 public void generateExpire(JavaWriter out) 362 throws IOException ; 363 364 367 public void generateInvalidateForeign(JavaWriter out) 368 throws IOException ; 369 370 373 public void childDelete(AmberConnection aConn, Serializable primaryKey) 374 throws SQLException ; 375 376 379 public String generateCastFromObject(String value); 380 381 384 public String generateEquals(String leftBase, String value); 385 386 389 public AmberExpr createExpr(QueryParser parser, PathExpr parent); 390 } 391 | Popular Tags |