KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > digester > xmlrules > TestObject


1 /* $Id: TestObject.java 155412 2005-02-26 12:58:36Z dirkv $
2  *
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * 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
18 package org.apache.commons.digester.xmlrules;
19
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.HashMap JavaDoc;
23 import java.util.Iterator JavaDoc;
24
25
26 /**
27  * Test harness object for holding results of digestion.
28  *
29  * @author David H. Martin - Initial Contribution
30  * @author Scott Sanders - Added ASL, removed external dependencies
31  * @author Tim O'Brien - Added bean property to test bean property setter rule
32  */

33 public class TestObject {
34
35     private ArrayList JavaDoc children = new ArrayList JavaDoc();
36     private String JavaDoc value = "";
37     private Long JavaDoc longValue = new Long JavaDoc(-1L);
38
39     private String JavaDoc property = "";
40
41     private HashMap JavaDoc mapValue = new HashMap JavaDoc();
42
43     private boolean pushed = false;
44     
45     public TestObject() {
46     }
47
48     private static int idx = 0;
49
50     public String JavaDoc toString() {
51         String JavaDoc str = value;
52         for (Iterator JavaDoc i = children.iterator(); i.hasNext();) {
53             str += " " + i.next();
54         }
55         return str;
56     }
57
58     public void add(Object JavaDoc o) {
59         children.add(o);
60     }
61
62     public void setValue(String JavaDoc val) {
63         value = val;
64     }
65
66     public void setLongValue(Long JavaDoc val) {
67         longValue = val;
68     }
69
70     public Long JavaDoc getLongValue() {
71         return longValue;
72     }
73
74     public void setStringValue(String JavaDoc val) {
75     }
76
77     public boolean isPushed() {
78         return pushed;
79     }
80     
81     public void push() {
82         pushed = true;
83     }
84
85     public void setMapValue( String JavaDoc name, String JavaDoc value ) {
86         this.mapValue.put( name, value );
87     }
88
89     public String JavaDoc getMapValue( String JavaDoc name ) {
90         return (String JavaDoc) this.mapValue.get( name );
91     }
92
93     public String JavaDoc getProperty() {
94         return property;
95     }
96
97     public void setProperty(String JavaDoc pProperty) {
98         property = pProperty;
99     }
100 }
101
Popular Tags