01: package com.completex.objective.components.persistency.mapper.impl;
02:
03: import java.util.regex.Matcher;
04: import java.util.regex.Pattern;
05:
06: /**
07: * @author Gennady Krizhevsky
08: */
09: public class MapperToken {
10:
11: private String token;
12:
13: public MapperToken(String token) {
14: this .token = token;
15: }
16:
17: public boolean equals(Object value) {
18: if (this == value)
19: return true;
20: if (value == null || getClass() != value.getClass())
21: return false;
22:
23: final MapperToken that = (MapperToken) value;
24:
25: if (token == null && that.token == null) {
26: return true;
27: } else if (that.token == null) {
28: return false;
29: }
30:
31: if (that.token.equals(token)) {
32: return true;
33: }
34:
35: Pattern filterPattern = Pattern.compile(token);
36: Matcher m = filterPattern.matcher(that.token);
37:
38: return m.matches();
39: }
40:
41: public int hashCode() {
42: return (token != null ? token.hashCode() : 0);
43: }
44:
45: }
|