KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > flow > java > VarMap


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.cocoon.components.flow.java;
17
18 import java.util.HashMap JavaDoc;
19 import java.util.Map JavaDoc;
20
21 /**
22  * Simplified version of a map.
23  *
24  * @author <a HREF="mailto:stephan@apache.org">Stephan Michels</a>
25  * @version CVS $Id: VarMap.java 30932 2004-07-29 17:35:38Z vgritsenko $
26  */

27 public class VarMap {
28     private HashMap JavaDoc map = new HashMap JavaDoc();
29
30     public VarMap() {
31     }
32
33     public VarMap(String JavaDoc name, Object JavaDoc value) {
34         add(name, value);
35     }
36
37     public VarMap(String JavaDoc name, int value) {
38         add(name, value);
39     }
40
41     public VarMap(String JavaDoc name, long value) {
42         add(name, value);
43     }
44
45     public VarMap(String JavaDoc name, float value) {
46         add(name, value);
47     }
48
49     public VarMap(String JavaDoc name, double value) {
50         add(name, value);
51     }
52
53     public VarMap add(String JavaDoc name, Object JavaDoc value) {
54         map.put(name, value);
55         return this;
56     }
57
58     public VarMap add(String JavaDoc name, int value) {
59         add(name, new Integer JavaDoc(value));
60         return this;
61     }
62
63     public VarMap add(String JavaDoc name, long value) {
64         add(name, new Long JavaDoc(value));
65         return this;
66     }
67
68     public VarMap add(String JavaDoc name, float value) {
69         add(name, new Float JavaDoc(value));
70         return this;
71     }
72
73     public VarMap add(String JavaDoc name, double value) {
74         add(name, new Double JavaDoc(value));
75         return this;
76     }
77
78     public Map JavaDoc getMap() {
79         return map;
80     }
81 }
82
Popular Tags