KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.ubermq.jms.common.routing.impl;
2
3 import com.ubermq.jms.common.routing.*;
4
5 /**
6  * A trivial implementation of a source descriptor that simply contains a string value.
7  *
8  */

9 public class StaticSourceDescriptor
10     implements SourceDescriptor, java.io.Serializable JavaDoc
11 {
12     private String JavaDoc expr;
13     
14     /**
15      * Constructs a static source specifier, from
16      * the given string expression.
17      * @param expr the expression representing the source specifier.
18      */

19     public StaticSourceDescriptor(String JavaDoc expr)
20     {
21         this.expr = expr;
22     }
23     
24     public String JavaDoc getDisplayName() {return expr;}
25     public String JavaDoc toString() {return expr;}
26     public String JavaDoc getMatchValue() {return expr;}
27
28     public int hashCode()
29     {
30         return expr.hashCode();
31     }
32     
33     public boolean equals(Object JavaDoc o)
34     {
35         if (o instanceof SourceSpec) {
36             return this.toString().equals(o.toString());
37         }
38         else return false;
39     }
40 }
41
42
Popular Tags