1 21 package com.db4o.test.types; 22 23 import com.db4o.*; 24 import com.db4o.config.*; 25 26 public class TCustomConstructor implements ObjectConstructor 27 { 28 public Object onStore(ObjectContainer con, Object obj){ 29 CustomConstructor cc = (CustomConstructor)obj; 30 String [] strings = new String [2]; 31 strings[0] = cc.name; 32 strings[1] = cc.tname; 33 return strings; 34 } 35 36 public void onActivate(ObjectContainer con, Object obj, Object members){ 37 } 39 40 public Object onInstantiate(ObjectContainer container, Object storedObject){ 41 String [] strings = (String [])storedObject; 42 CustomConstructor cc = new CustomConstructor(strings[1]); 43 cc.name = strings[0]; 44 return cc; 45 } 46 47 public Class storedClass(){ 48 return String [].class; 49 } 50 } 51 | Popular Tags |