1 2 12 package com.versant.core.jdo.sco.detached; 13 14 import com.versant.core.jdo.VersantPersistenceManager; 15 import com.versant.core.jdo.VersantStateManager; 16 import com.versant.core.common.VersantFieldMetaData; 17 import com.versant.core.jdo.sco.VersantSCOFactory; 18 import com.versant.core.jdo.sco.VersantSimpleSCO; 19 import com.versant.core.jdo.VersantPersistenceManager; 20 21 import javax.jdo.spi.PersistenceCapable; 22 import java.io.Serializable ; 23 24 import com.versant.core.common.BindingSupportImpl; 25 26 29 public class DetachSCODateFactory implements VersantSCOFactory, 30 Serializable { 31 32 35 public VersantSimpleSCO createSCO(PersistenceCapable owner, 36 VersantPersistenceManager pm, VersantStateManager stateManager, 37 VersantFieldMetaData fmd, Object o) { 38 if (o instanceof java.util.Date ) { 39 return new DetachSCODate(owner, stateManager, 40 fmd, ((java.util.Date ) o).getTime()); 41 } else if (o instanceof Long ) { 42 return new DetachSCODate(owner, stateManager, 43 fmd, ((Long ) o).longValue()); 44 } else { 45 throw BindingSupportImpl.getInstance().illegalArgument(o.getClass() + " can not be converted into a Date SCO"); 46 } 47 } 48 } 49 | Popular Tags |