01
/**//* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com */
02
package com.db4odoc.tpclone;
03
04
import com.db4o.activation.ActivationPurpose;
05
import com.db4o.activation.Activator;
06
import com.db4o.ta.Activatable;
07
08
public class Car implements Activatable, Cloneable ...{
09
private String model;
10
private Pilot pilot;
11
transient Activator _activator;
12
13
public Car(String model, Pilot pilot) ...{
14
this.model = model;
15
this.pilot = pilot;
16
}
17
// end Car
18
19
public Object clone() throws CloneNotSupportedException ...{
20
return super.clone();
21
}
22
// end clone
23
24
// Bind the class to an object container
25
public void bind(Activator activator) ...{
26
if (_activator == activator) ...{
27
return;
28
}
29
if (activator != null && _activator != null) ...{
30
throw new IllegalStateException();
31
}
32
_activator = activator;
33
}
34
// end bind
35
36
// activate the object fields
37
public void activate(ActivationPurpose purpose) ...{
38
if (_activator == null)
39
return;
40
_activator.activate(purpose);
41
}
42
// end activate
43
44
45
public String getModel() ...{
46
activate(ActivationPurpose.READ);
47
return model;
48
}
49
// end getModel
50
51
public String toString() ...{
52
activate(ActivationPurpose.READ);
53
return model + "[" + pilot + "]";
54
}
55
// end toString
56
57
}