View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.jxpath;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.HashMap;
22  import java.util.List;
23  import java.util.Map;
24  
25  import org.apache.commons.jxpath.xml.DocumentContainer;
26  import org.w3c.dom.Document;
27  import org.w3c.dom.Element;
28  
29  /**
30   * Mixed model test bean: Java, collections, map, DOM, Container.
31   *
32   * @author Dmitri Plotnikov
33   * @version $Revision: 480417 $ $Date: 2006-11-29 00:37:40 -0500 (Wed, 29 Nov 2006) $
34   */
35  public class TestMixedModelBean {
36      private String string;
37      private TestBean bean;
38      private Container container;
39      private Document document;
40      private Element element;
41  
42      private Map map;
43  
44      private List list;
45      private int[][] matrix;
46  
47      public TestMixedModelBean() {
48          string = "string";
49          bean = new TestBean();
50          map = new HashMap();
51          list = new ArrayList();
52  
53          container = new DocumentContainer(getClass().getResource("Vendor.xml"));
54          document = (Document) container.getValue();
55          element = document.getDocumentElement();
56  
57          map.put("string", string);
58          map.put("bean", bean);
59          map.put("map", map);
60          map.put("list", list);
61          map.put("document", document);
62          map.put("element", element);
63          map.put("container", container);
64  
65          list.add(string);
66          list.add(bean);
67          list.add(map);
68          list.add(new ArrayList(Collections.singletonList("string2")));
69          list.add(document);
70          list.add(element);
71          list.add(container);
72  
73          matrix = new int[1][];
74          matrix[0] = new int[1];
75          matrix[0][0] = 3;
76      }
77  
78      public String getString() {
79          return string;
80      }
81  
82      public TestBean getBean() {
83          return bean;
84      }
85  
86      public Map getMap() {
87          return map;
88      }
89  
90      public List getList() {
91          return list;
92      }
93  
94      public Document getDocument() {
95          return document;
96      }
97  
98      public Element getElement() {
99          return element;
100     }
101 
102     public Container getContainer() {
103         return container;
104     }
105 
106     public int[][] getMatrix() {
107         return matrix;
108     }
109 
110     public void setMatrix(int[][] matrix) {
111         this.matrix = matrix;
112     }
113 }