KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > naming > deployment > jsr88 > Pattern


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.naming.deployment.jsr88;
18
19 import java.io.Serializable JavaDoc;
20
21 /**
22  * Holds the elements that make up an ObjectName. This class exists
23  * so that the bundle of elements can be get, set, and edited together
24  * separate from any other elements that may be on the parent.
25  *
26  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
27  */

28 public class Pattern implements Serializable JavaDoc {
29     private String JavaDoc groupId;
30     private String JavaDoc artifactId;
31     private String JavaDoc version;
32     private String JavaDoc module;
33     private String JavaDoc name;
34     private String JavaDoc type;
35
36     public String JavaDoc getGroupId() {
37         return groupId;
38     }
39
40     public void setGroupId(String JavaDoc groupId) {
41         this.groupId = groupId;
42     }
43
44     public String JavaDoc getArtifactId() {
45         return artifactId;
46     }
47
48     public void setArtifactId(String JavaDoc artifactId) {
49         this.artifactId = artifactId;
50     }
51
52     public String JavaDoc getVersion() {
53         return version;
54     }
55
56     public void setVersion(String JavaDoc version) {
57         this.version = version;
58     }
59
60     public String JavaDoc getModule() {
61         return module;
62     }
63
64     public void setModule(String JavaDoc module) {
65         this.module = module;
66     }
67
68     public String JavaDoc getName() {
69         return name;
70     }
71
72     public void setName(String JavaDoc name) {
73         this.name = name;
74     }
75
76
77     public String JavaDoc getType() {
78         return type;
79     }
80
81     public void setType(String JavaDoc type) {
82         this.type = type;
83     }
84
85     public boolean empty() {
86         return (groupId == null || groupId.trim().equals("")) &&
87                 (artifactId == null || artifactId.trim().equals("")) &&
88                 (version == null || version.trim().equals("")) &&
89                 (module == null || module.trim().equals("")) &&
90                 (name == null || name.trim().equals("")) &&
91                 (type == null || type.trim().equals(""));
92     }
93
94     public boolean equals(Object JavaDoc o) {
95         if (this == o) return true;
96         if (o == null || getClass() != o.getClass()) return false;
97
98         final Pattern pattern = (Pattern) o;
99
100         if (artifactId != null ? !artifactId.equals(pattern.artifactId) : pattern.artifactId != null) return false;
101         if (groupId != null ? !groupId.equals(pattern.groupId) : pattern.groupId != null) return false;
102         if (module != null ? !module.equals(pattern.module) : pattern.module != null) return false;
103         if (name != null ? !name.equals(pattern.name) : pattern.name != null) return false;
104         if (type != null ? !type.equals(pattern.type) : pattern.type != null) return false;
105         if (version != null ? !version.equals(pattern.version) : pattern.version != null) return false;
106
107         return true;
108     }
109
110     public int hashCode() {
111         int result;
112         result = (groupId != null ? groupId.hashCode() : 0);
113         result = 29 * result + (artifactId != null ? artifactId.hashCode() : 0);
114         result = 29 * result + (version != null ? version.hashCode() : 0);
115         result = 29 * result + (module != null ? module.hashCode() : 0);
116         result = 29 * result + (name != null ? name.hashCode() : 0);
117         result = 29 * result + (type != null ? type.hashCode() : 0);
118         return result;
119     }
120 }
121
Popular Tags