KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > explorer > context > lib > DecoderContextContainer


1 /*====================================================================
2
3 Objectweb Explorer Framework
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library 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 library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Moroy, Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26 package org.objectweb.util.explorer.context.lib;
27
28 import org.objectweb.util.explorer.api.Entry;
29 import org.objectweb.util.explorer.core.common.api.ContextContainer;
30 import org.objectweb.util.explorer.core.common.lib.DefaultContextContainer;
31
32 /**
33  *
34  *
35  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jérôme Moroy</a>,
36  * <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>.
37  *
38  * @version 0.1
39  */

40 public class DecoderContextContainer
41      extends DecoderContext
42   implements ContextContainer
43 {
44
45     //==================================================================
46
//
47
// Internal States.
48
//
49
// ==================================================================
50

51     protected ContextContainer delegate_ = null;
52   
53     // ==================================================================
54
//
55
// Constructors.
56
//
57
// ==================================================================
58

59     /**
60      * Default Constructor
61      */

62     public DecoderContextContainer(){
63         this(new DefaultContextContainer());
64     }
65     
66     /**
67      * Constructor with specific delegate
68      */

69     public DecoderContextContainer(ContextContainer delegate){
70         if(delegate!=null)
71             delegate_ = delegate;
72         else
73             delegate_ = new DefaultContextContainer();
74         super.delegate_= this.delegate_;
75     }
76     
77     // ==================================================================
78
//
79
// Internal methods.
80
//
81
// ==================================================================
82

83     // ==================================================================
84
//
85
// Public methods for ContextContainer interface.
86
//
87
// ==================================================================
88

89     /* (non-Javadoc)
90      * @see org.objectweb.util.explorer.core.common.api.ContextContainer#getEntry(java.lang.Object)
91      */

92     public Entry getEntry(Object JavaDoc name) {
93         Entry entry = delegate_.getEntry(name);
94         if(entry!=null && decoder_!=null){
95             entry.setValue(decoder_.decode(entry.getValue()));
96         }
97         return entry;
98     }
99
100     /* (non-Javadoc)
101      * @see org.objectweb.util.explorer.core.common.api.ContextContainer#addEntry(java.lang.Object, java.lang.Object)
102      */

103     public void addEntry(Object JavaDoc name, Object JavaDoc value) {
104         delegate_.addEntry(name,value);
105     }
106
107     /* (non-Javadoc)
108      * @see org.objectweb.util.explorer.core.common.api.ContextContainer#addEntry(org.objectweb.util.explorer.api.Entry)
109      */

110     public void addEntry(Entry entry) {
111         delegate_.addEntry(entry);
112     }
113
114     /* (non-Javadoc)
115      * @see org.objectweb.util.explorer.core.common.api.ContextContainer#removeEntry(java.lang.Object)
116      */

117     public void removeEntry(Object JavaDoc name) {
118         delegate_.removeEntry(name);
119     }
120
121     /* (non-Javadoc)
122      * @see org.objectweb.util.explorer.core.common.api.ContextContainer#clear()
123      */

124     public void clear() {
125         delegate_.clear();
126     }
127
128     /* (non-Javadoc)
129      * @see org.objectweb.util.explorer.core.common.api.ContextContainer#getSize()
130      */

131     public int getSize() {
132         return delegate_.getSize();
133     }
134     
135 }
136
137
138
Popular Tags