KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > phoenix > components > configuration > ConfigurationKey


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.phoenix.components.configuration;
9
10 final class ConfigurationKey
11 {
12     private final String JavaDoc m_application;
13
14     private final String JavaDoc m_block;
15
16     public ConfigurationKey( String JavaDoc application, String JavaDoc block )
17     {
18         this.m_application = application;
19         this.m_block = block;
20     }
21
22     public int hashCode()
23     {
24         return this.getApplication().hashCode() + this.getBlock().hashCode();
25     }
26
27     public boolean equals( Object JavaDoc obj )
28     {
29         if( obj instanceof ConfigurationKey )
30         {
31             final ConfigurationKey key = (ConfigurationKey)obj;
32
33             return this.getApplication().equals( key.getApplication() )
34                 && this.getBlock().equals( key.getBlock() );
35         }
36         else
37         {
38             return false;
39         }
40     }
41
42     public String JavaDoc getApplication()
43     {
44         return m_application;
45     }
46
47     public String JavaDoc getBlock()
48     {
49         return m_block;
50     }
51 }
52
Popular Tags