1 package org.apache.torque.oid; 2 3 21 22 import org.apache.torque.adapter.DB; 23 import org.apache.torque.adapter.IDMethod; 24 25 32 public class IDGeneratorFactory 33 { 34 40 private IDGeneratorFactory() 41 { 42 } 43 44 48 public static final String [] ID_GENERATOR_METHODS = 49 { 50 IDMethod.NATIVE, IDMethod.AUTO_INCREMENT, IDMethod.SEQUENCE 51 }; 52 53 63 public static IdGenerator create(DB dbAdapter, String name) 64 { 65 String idMethod = dbAdapter.getIDMethodType(); 66 if (IDMethod.AUTO_INCREMENT.equals(idMethod)) 67 { 68 return new AutoIncrementIdGenerator(dbAdapter, name); 69 } 70 else if (IDMethod.SEQUENCE.equals(idMethod)) 71 { 72 return new SequenceIdGenerator(dbAdapter, name); 73 } 74 else 75 { 76 return null; 77 } 78 } 79 } 80 | Popular Tags |