001: /*
002: * Copyright 1999-2004 The Apache Software Foundation
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.apache.commons.jxpath;
017:
018: import java.util.ArrayList;
019: import java.util.Collections;
020: import java.util.HashMap;
021: import java.util.List;
022: import java.util.Map;
023:
024: import org.apache.commons.jxpath.xml.DocumentContainer;
025: import org.w3c.dom.Document;
026: import org.w3c.dom.Element;
027:
028: /**
029: * Mixed model test bean: Java, collections, map, DOM, Container.
030: *
031: * @author Dmitri Plotnikov
032: * @version $Revision: 1.7 $ $Date: 2004/02/29 14:17:40 $
033: */
034: public class TestMixedModelBean {
035: private String string;
036: private TestBean bean;
037: private Container container;
038: private Document document;
039: private Element element;
040:
041: private Map map;
042:
043: private List list;
044: private int[][] matrix;
045:
046: public TestMixedModelBean() {
047: string = "string";
048: bean = new TestBean();
049: map = new HashMap();
050: list = new ArrayList();
051:
052: container = new DocumentContainer(getClass().getResource(
053: "Vendor.xml"));
054: document = (Document) container.getValue();
055: element = document.getDocumentElement();
056:
057: map.put("string", string);
058: map.put("bean", bean);
059: map.put("map", map);
060: map.put("list", list);
061: map.put("document", document);
062: map.put("element", element);
063: map.put("container", container);
064:
065: list.add(string);
066: list.add(bean);
067: list.add(map);
068: list.add(new ArrayList(Collections.singletonList("string2")));
069: list.add(document);
070: list.add(element);
071: list.add(container);
072:
073: matrix = new int[1][];
074: matrix[0] = new int[1];
075: matrix[0][0] = 3;
076: }
077:
078: public String getString() {
079: return string;
080: }
081:
082: public TestBean getBean() {
083: return bean;
084: }
085:
086: public Map getMap() {
087: return map;
088: }
089:
090: public List getList() {
091: return list;
092: }
093:
094: public Document getDocument() {
095: return document;
096: }
097:
098: public Element getElement() {
099: 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: }
|