KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > mx > mxbean > support > CollectionsMXBeanSupport


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2006, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.test.mx.mxbean.support;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.Collection JavaDoc;
26 import java.util.List JavaDoc;
27 import java.util.ListIterator JavaDoc;
28 import java.util.Map JavaDoc;
29 import java.util.Set JavaDoc;
30
31 import org.jboss.mx.mxbean.MXBeanSupport;
32
33 /**
34  * CollectionsMXBeanSupport.
35  *
36  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
37  * @version $Revision: 1.1 $
38  */

39 public class CollectionsMXBeanSupport extends MXBeanSupport implements CollectionsMXBeanSupportMXBean
40 {
41    String JavaDoc[] array;
42    Collection JavaDoc<String JavaDoc> collection;
43    Set JavaDoc<String JavaDoc> set;
44    List JavaDoc<String JavaDoc> list;
45    Map JavaDoc<String JavaDoc, Integer JavaDoc> map;
46    TestEnum enumeration;
47    
48    public CollectionsMXBeanSupport()
49    {
50    }
51    
52    public CollectionsMXBeanSupport(String JavaDoc[] array, Collection JavaDoc<String JavaDoc> collection, Set JavaDoc<String JavaDoc> set, List JavaDoc<String JavaDoc> list, Map JavaDoc<String JavaDoc, Integer JavaDoc> map, TestEnum enumeration)
53    {
54       this.array = array;
55       this.collection = collection;
56       this.set = set;
57       this.list = list;
58       this.map = map;
59       this.enumeration = enumeration;
60    }
61
62    public String JavaDoc[] getArray()
63    {
64       return array;
65    }
66    
67    public Collection JavaDoc<String JavaDoc> getCollection()
68    {
69       return collection;
70    }
71
72    public List JavaDoc<String JavaDoc> getList()
73    {
74       return list;
75    }
76
77    public Set JavaDoc<String JavaDoc> getSet()
78    {
79       return set;
80    }
81
82    public Map JavaDoc<String JavaDoc, Integer JavaDoc> getMap()
83    {
84       return map;
85    }
86    
87    public TestEnum getEnum()
88    {
89       return enumeration;
90    }
91
92    public void setEnum(TestEnum enumeration)
93    {
94       this.enumeration = enumeration;
95    }
96
97    public void setArray(String JavaDoc[] array)
98    {
99       this.array = array;
100    }
101
102    public void setCollection(Collection JavaDoc<String JavaDoc> collection)
103    {
104       this.collection = collection;
105    }
106
107    public void setList(List JavaDoc<String JavaDoc> list)
108    {
109       this.list = list;
110    }
111
112    public void setMap(Map JavaDoc<String JavaDoc, Integer JavaDoc> map)
113    {
114       this.map = map;
115    }
116
117    public void setSet(Set JavaDoc<String JavaDoc> set)
118    {
119       this.set = set;
120    }
121
122    public List JavaDoc<String JavaDoc> echoReverse(List JavaDoc<String JavaDoc> list)
123    {
124       ArrayList JavaDoc<String JavaDoc> result = new ArrayList JavaDoc<String JavaDoc>(list.size());
125       for (ListIterator JavaDoc<String JavaDoc> i = list.listIterator(list.size()); i.hasPrevious();)
126          result.add(i.previous());
127       return result;
128    }
129 }
130
Popular Tags