KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ubermq > jms > common > routing > impl > StaticSourceSpec


1 package com.ubermq.jms.common.routing.impl;
2
3 import com.ubermq.jms.common.routing.*;
4
5 public class StaticSourceSpec
6     implements SourceSpec, java.io.Serializable JavaDoc
7 {
8     private String JavaDoc expr;
9     
10     /**
11      * Constructs a static source specifier, from
12      * the given string expression.
13      * @param expr the expression representing the source specifier.
14      */

15     public StaticSourceSpec(String JavaDoc expr)
16     {
17         this.expr = expr;
18     }
19     
20     public String JavaDoc getDisplayName() {return expr;}
21     public String JavaDoc toString() {return expr;}
22     
23     /**
24      * Strictly matches this static specifier and
25      * another implementation of the interface.
26      */

27     public boolean matches(SourceDescriptor s)
28     {
29         return expr.equals(s.getMatchValue());
30     }
31
32     public boolean isMoreSpecificThan(SourceSpec s)
33     {
34         return false;
35     }
36     
37     public int hashCode()
38     {
39         return expr.hashCode();
40     }
41     
42     public boolean equals(Object JavaDoc o)
43     {
44         if (o instanceof SourceSpec) {
45             return this.toString().equals(o.toString());
46         }
47         else return false;
48     }
49     
50     public boolean isIdempotentForEqualDescriptors()
51     {
52         return true;
53     }
54 }
55
56
Popular Tags