1 2 12 package com.versant.core.jdo.sco; 13 14 import com.versant.core.jdo.VersantPersistenceManager; 15 import com.versant.core.jdo.VersantStateManager; 16 import com.versant.core.common.VersantFieldMetaData; 17 18 import javax.jdo.spi.PersistenceCapable; 19 import java.io.Serializable ; 20 21 import com.versant.core.common.BindingSupportImpl; 22 import com.versant.core.jdo.VersantPersistenceManager; 23 import com.versant.core.jdo.VersantStateManager; 24 25 28 public class DateSCOFactory implements VersantSCOFactory, 29 Serializable { 30 31 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 com.versant.core.jdo.sco.Date(owner, stateManager, 40 fmd, ((java.util.Date ) o).getTime()); 41 } else if (o instanceof Long ) { 42 return new com.versant.core.jdo.sco.Date(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 |