    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;
    19  import java.util.Collections;
    20  import java.util.HashMap;
    21  import java.util.List;
    22  import java.util.Map;
    23
    24  import org.apache.commons.jxpath.xml.DocumentContainer;
    25  import org.w3c.dom.Document;
    26  import org.w3c.dom.Element;
    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 string;
    36      private TestBean bean;
    37      private Container container;
    38      private Document document;
    39      private Element element;
    40
    41      private Map map;
    42
    43      private List list;
    44      private int[][] matrix;
    45
    46      public TestMixedModelBean() {
    47          string = "string";
    48          bean = new TestBean();
    49          map = new HashMap();
    50          list = new ArrayList();
    51
    52          container = new DocumentContainer(getClass().getResource("Vendor.xml"));
    53          document = (Document) 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(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 getString() {
    78          return string;
    79      }
    80
    81      public TestBean getBean() {
    82          return bean;
    83      }
    84
    85      public Map getMap() {
    86          return map;
    87      }
    88
    89      public List getList() {
    90          return list;
    91      }
    92
    93      public Document getDocument() {
    94          return document;
    95      }
    96
    97      public Element 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 }