KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jofti > api > NameSpaceKey


1 /*
2  * Copyright (C) <2005> <Steve Woodcock>
3  * Created on Jun 10, 2005
4  *
5  */

6 package com.jofti.api;
7
8
9 /**
10  
11  *
12  * This is used to wrap the key objects used in caches that are name space aware, such
13  * as JBossCache. The NameSpaceKey object is returned from queries as the key object in the result map.
14  * There is an implicit ordering by nameSpace and then by the key.<p>
15  *
16  * The ordering is defined by (as pseudocode)<br>
17  * if nameSpace instance of comparable && namespace.class == other.class <br>
18  * then use namespace.compareTo(other)<br>
19  * else use comparison of namespace.toString().compareTo(other.toString()).<br>
20  * <p>
21  * So for namespaces that are the same type and implement comparable then
22  * a correct ordering will occur otherwise you will get a lexical ordering
23  * based on the toString() method.
24  * <p>
25  * It is recommended that you use namspaces that are the same type.
26  * <p>
27  * The keys are compared in a similar manner.<p>
28  *
29  * @author Steve Woodcock<br>
30  * @version 1.5
31  */

32 public interface NameSpaceKey extends Comparable JavaDoc{
33
34     /**
35      * Gets the namespace part of the NameSpaceKey. The object is dependent upon the Cache implementation used.
36      * @return - the nameSpace.
37      */

38     public Object JavaDoc getNameSpace();
39     
40     /**
41      * Gets the key part of the NameSpaceKey.
42      * @return - the key under which the object was stored..
43      */

44     public Object JavaDoc getKey();
45 }
46
Popular Tags