01: /*
02: * Copyright (C) <2005> <Steve Woodcock>
03: * Created on Jun 10, 2005
04: *
05: */
06: package com.jofti.api;
07:
08: /**
09:
10: *
11: * This is used to wrap the key objects used in caches that are name space aware, such
12: * as JBossCache. The NameSpaceKey object is returned from queries as the key object in the result map.
13: * There is an implicit ordering by nameSpace and then by the key.<p>
14: *
15: * The ordering is defined by (as pseudocode)<br>
16: * if nameSpace instance of comparable && namespace.class == other.class <br>
17: * then use namespace.compareTo(other)<br>
18: * else use comparison of namespace.toString().compareTo(other.toString()).<br>
19: * <p>
20: * So for namespaces that are the same type and implement comparable then
21: * a correct ordering will occur otherwise you will get a lexical ordering
22: * based on the toString() method.
23: * <p>
24: * It is recommended that you use namspaces that are the same type.
25: * <p>
26: * The keys are compared in a similar manner.<p>
27: *
28: * @author Steve Woodcock<br>
29: * @version 1.5
30: */
31: public interface NameSpaceKey extends Comparable {
32:
33: /**
34: * Gets the namespace part of the NameSpaceKey. The object is dependent upon the Cache implementation used.
35: * @return - the nameSpace.
36: */
37: public Object getNameSpace();
38:
39: /**
40: * Gets the key part of the NameSpaceKey.
41: * @return - the key under which the object was stored..
42: */
43: public Object getKey();
44: }
|