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 06. September 2007 by Joerg Schaible
10: */
11: package com.thoughtworks.xstream.benchmark.reflection.targets;
12:
13: import com.thoughtworks.xstream.benchmark.reflection.model.A50StaticInnerClasses;
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 StaticInnerClassesReflection extends
27: AbstractReflectionTarget {
28:
29: public StaticInnerClassesReflection() {
30: super (new ArrayList());
31: List list = (List) target();
32: for (int i = 0; i < 10; ++i) {
33: StringBuffer name = new StringBuffer(
34: A50StaticInnerClasses.class.getName());
35: for (int j = 0; j < 50; ++j) {
36: String no = "0" + j;
37: try {
38: name.append("$L");
39: name.append(no.substring(no.length() - 2));
40: Class cls = Class.forName(name.toString());
41: Object o = cls.newInstance();
42: fill(o);
43: list.add(o);
44: } catch (ClassNotFoundException e) {
45: throw new RuntimeException(e);
46: } catch (InstantiationException e) {
47: throw new RuntimeException(e);
48: } catch (IllegalAccessException e) {
49: throw new RuntimeException(e);
50: }
51: }
52: }
53: }
54:
55: public String toString() {
56: return "StaticInnerClasses Target";
57: }
58:
59: }
|