01: /*
02: * Copyright (C) 2007 XStream Committers.
03: * All rights reserved.
04: *
05: * The software in this package is published under the terms of the BSD
06: * style license a copy of which has been included with this distribution in
07: * the LICENSE.txt file.
08: *
09: * Created on 26. June 2007 by Joerg Schaible
10: */
11: package com.thoughtworks.xstream.benchmark.reflection.targets;
12:
13: import com.thoughtworks.xstream.benchmark.reflection.model.A100Parents;
14: import com.thoughtworks.xstream.tools.benchmark.Target;
15:
16: import java.util.ArrayList;
17: import java.util.List;
18:
19: /**
20: * A Target for multiple hierarchy level classes.
21: *
22: * @author Jörg Schaible
23: * @see com.thoughtworks.xstream.tools.benchmark.Harness
24: * @see Target
25: */
26: public class HierarchyLevelReflection extends AbstractReflectionTarget {
27:
28: public HierarchyLevelReflection() {
29: super (new ArrayList());
30: List list = (List) target();
31: for (int i = 0; i < 100; ++i) {
32: String no = "00" + i;
33: try {
34: Class cls = Class.forName(A100Parents.class.getName()
35: + "$Parent" + no.substring(no.length() - 3));
36: Object o = cls.newInstance();
37: fill(o);
38: list.add(o);
39: } catch (ClassNotFoundException e) {
40: throw new RuntimeException(e);
41: } catch (InstantiationException e) {
42: throw new RuntimeException(e);
43: } catch (IllegalAccessException e) {
44: throw new RuntimeException(e);
45: }
46: }
47: }
48:
49: public String toString() {
50: return "HierarchyLevel Target";
51: }
52:
53: }
|