KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > lang > Layer


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.lang;
9
10 import java.util.HashMap JavaDoc;
11 import java.util.Map JavaDoc;
12
13 /**
14  * This object represents a Layer in the <code>LayeredThreadContext</code>.
15  *
16  * Note: LayeredThreadContext assumes Layers are immutable in duplicate() method.
17  *
18  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
19  */

20 final class Layer
21 {
22     private Object JavaDoc m_key;
23     private Map JavaDoc m_map;
24     private boolean m_isDivider;
25
26     public Layer( final Object JavaDoc key, final Map JavaDoc map, final boolean isDivider )
27     {
28         m_key = key;
29         m_map = map;
30         m_isDivider = isDivider;
31     }
32
33     protected boolean matchesKey( final Object JavaDoc other )
34     {
35         return m_key.equals( other );
36     }
37
38     protected boolean isDivider()
39     {
40         return m_isDivider;
41     }
42
43     protected boolean containsKey( final String JavaDoc key )
44     {
45         return m_map.containsKey( key );
46     }
47
48     protected Object JavaDoc get( final String JavaDoc key )
49     {
50         return m_map.get( key );
51     }
52 }
53
54
Popular Tags