KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > jxpath > TestMixedModelBean


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.jxpath;
17
18 import java.util.ArrayList JavaDoc;
19 import java.util.Collections JavaDoc;
20 import java.util.HashMap JavaDoc;
21 import java.util.List JavaDoc;
22 import java.util.Map JavaDoc;
23
24 import org.apache.commons.jxpath.xml.DocumentContainer;
25 import org.w3c.dom.Document JavaDoc;
26 import org.w3c.dom.Element JavaDoc;
27
28 /**
29  * Mixed model test bean: Java, collections, map, DOM, Container.
30  *
31  * @author Dmitri Plotnikov
32  * @version $Revision: 1.7 $ $Date: 2004/02/29 14:17:40 $
33  */

34 public class TestMixedModelBean {
35     private String JavaDoc string;
36     private TestBean bean;
37     private Container container;
38     private Document JavaDoc document;
39     private Element JavaDoc element;
40
41     private Map JavaDoc map;
42
43     private List JavaDoc list;
44     private int[][] matrix;
45
46     public TestMixedModelBean() {
47         string = "string";
48         bean = new TestBean();
49         map = new HashMap JavaDoc();
50         list = new ArrayList JavaDoc();
51
52         container = new DocumentContainer(getClass().getResource("Vendor.xml"));
53         document = (Document JavaDoc) container.getValue();
54         element = document.getDocumentElement();
55
56         map.put("string", string);
57         map.put("bean", bean);
58         map.put("map", map);
59         map.put("list", list);
60         map.put("document", document);
61         map.put("element", element);
62         map.put("container", container);
63
64         list.add(string);
65         list.add(bean);
66         list.add(map);
67         list.add(new ArrayList JavaDoc(Collections.singletonList("string2")));
68         list.add(document);
69         list.add(element);
70         list.add(container);
71
72         matrix = new int[1][];
73         matrix[0] = new int[1];
74         matrix[0][0] = 3;
75     }
76
77     public String JavaDoc getString() {
78         return string;
79     }
80
81     public TestBean getBean() {
82         return bean;
83     }
84
85     public Map JavaDoc getMap() {
86         return map;
87     }
88
89     public List JavaDoc getList() {
90         return list;
91     }
92
93     public Document JavaDoc getDocument() {
94         return document;
95     }
96
97     public Element JavaDoc getElement() {
98         return element;
99     }
100
101     public Container getContainer() {
102         return container;
103     }
104
105     public int[][] getMatrix() {
106         return matrix;
107     }
108
109     public void setMatrix(int[][] matrix) {
110         this.matrix = matrix;
111     }
112 }
113
Popular Tags