001/* $Id: ObjectTestImpl.java 1102402 2011-05-12 18:03:26Z simonetripodi $
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one or more
004 * contributor license agreements.  See the NOTICE file distributed with
005 * this work for additional information regarding copyright ownership.
006 * The ASF licenses this file to You under the Apache License, Version 2.0
007 * (the "License"); you may not use this file except in compliance with
008 * the License.  You may obtain a copy of the License at
009 *
010 *      http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.commons.digester3.xmlrules;
020
021import java.util.ArrayList;
022import java.util.HashMap;
023
024/**
025 * Test harness object for holding results of digestion.
026 * 
027 * @author David H. Martin - Initial Contribution
028 * @author Scott Sanders - Added ASL, removed external dependencies
029 * @author Tim O'Brien - Added bean property to test bean property setter rule
030 */
031public class ObjectTestImpl
032{
033
034    private ArrayList<Object> children = new ArrayList<Object>();
035
036    private String value = "";
037
038    private Long longValue = new Long( -1L );
039
040    private String property = "";
041
042    private HashMap<String, String> mapValue = new HashMap<String, String>();
043
044    private boolean pushed = false;
045
046    public ObjectTestImpl()
047    {
048    }
049
050    @Override
051    public String toString()
052    {
053        String str = value;
054        for ( Object o : children )
055        {
056            str += " " + o;
057        }
058        return str;
059    }
060
061    public void add( Object o )
062    {
063        children.add( o );
064    }
065
066    public void setValue( String val )
067    {
068        value = val;
069    }
070
071    public void setLongValue( Long val )
072    {
073        longValue = val;
074    }
075
076    public Long getLongValue()
077    {
078        return longValue;
079    }
080
081    public void setStringValue( String val )
082    {
083    }
084
085    public boolean isPushed()
086    {
087        return pushed;
088    }
089
090    public void push()
091    {
092        pushed = true;
093    }
094
095    public void setMapValue( String name, String value )
096    {
097        this.mapValue.put( name, value );
098    }
099
100    public String getMapValue( String name )
101    {
102        return this.mapValue.get( name );
103    }
104
105    public String getProperty()
106    {
107        return property;
108    }
109
110    public void setProperty( String pProperty )
111    {
112        property = pProperty;
113    }
114}