| 1 21 package com.db4o.test; 22 23 import com.db4o.*; 24 25 28 public class CustomActivationDepth { 29 30 int myInt; 31 String myString; 32 int[] ints; 33 String [] strings; 34 35 CA1 ca1; 36 CA2 ca2; 37 CA3 ca3; 38 39 CA1[] ca1s; 40 CA2[] ca2s; 41 CA3[] ca3s; 42 43 44 public void configure(){ 45 Db4o.configure().objectClass(CA1.class).maximumActivationDepth(1); 46 } 47 48 49 public void storeOne(){ 50 myInt = 7; 51 myString = "seven"; 52 ints = new int[]{77}; 53 strings = new String []{"sevenseven"}; 54 ca1 = new CA1("1"); 55 ca2 = new CA2("2"); 56 ca3 = new CA3("3"); 57 58 ca1s = new CA1[] {new CA1("1arr1"), new CA1("1arr2")}; 59 ca2s = new CA2[] {new CA2("2arr1"), new CA2("2arr2")}; 60 ca3s = new CA3[] {new CA3("3arr1"), new CA3("3arr2")}; 61 62 Db4o.configure().activationDepth(0); 63 } 64 65 public void testOne(){ 66 Test.objectContainer().activate(this, 10); 67 68 Test.objectContainer().activate(this.ca1, 10); 69 70 Db4o.configure().activationDepth(5); 71 } 72 73 public static class CA1{ 74 75 public String name; 76 77 public CA2 ca2; 78 79 public CA1(){ 80 81 } 82 83 public CA1(String name){ 84 this.name = name; 85 ca2 = new CA2(name + ".2"); 86 } 87 88 89 } 90 91 public static class CA2{ 92 93 public String name; 94 95 public CA3 ca3; 96 97 public CA2(){ 98 99 } 100 101 public CA2(String name){ 102 this.name = name; 103 ca3 = new CA3(name + ".3"); 104 } 105 106 } 107 108 109 public static class CA3{ 110 111 public String name; 112 113 public CA3(){ 114 115 } 116 117 public CA3(String name){ 118 this.name = name; 119 } 120 121 } 122 123 124 125 126 127 } 128 | Popular Tags |