001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.naming.deployment.jsr88;
017:
018: import java.io.Serializable;
019:
020: /**
021: * Holds the elements that make up an ObjectName. This class exists
022: * so that the bundle of elements can be get, set, and edited together
023: * separate from any other elements that may be on the parent.
024: *
025: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
026: */
027: public class Pattern implements Serializable {
028: private String groupId;
029: private String artifactId;
030: private String version;
031: private String module;
032: private String name;
033: private String type;
034:
035: public String getGroupId() {
036: return groupId;
037: }
038:
039: public void setGroupId(String groupId) {
040: this .groupId = groupId;
041: }
042:
043: public String getArtifactId() {
044: return artifactId;
045: }
046:
047: public void setArtifactId(String artifactId) {
048: this .artifactId = artifactId;
049: }
050:
051: public String getVersion() {
052: return version;
053: }
054:
055: public void setVersion(String version) {
056: this .version = version;
057: }
058:
059: public String getModule() {
060: return module;
061: }
062:
063: public void setModule(String module) {
064: this .module = module;
065: }
066:
067: public String getName() {
068: return name;
069: }
070:
071: public void setName(String name) {
072: this .name = name;
073: }
074:
075: public String getType() {
076: return type;
077: }
078:
079: public void setType(String type) {
080: this .type = type;
081: }
082:
083: public boolean empty() {
084: return (groupId == null || groupId.trim().equals(""))
085: && (artifactId == null || artifactId.trim().equals(""))
086: && (version == null || version.trim().equals(""))
087: && (module == null || module.trim().equals(""))
088: && (name == null || name.trim().equals(""))
089: && (type == null || type.trim().equals(""));
090: }
091:
092: public boolean equals(Object o) {
093: if (this == o)
094: return true;
095: if (o == null || getClass() != o.getClass())
096: return false;
097:
098: final Pattern pattern = (Pattern) o;
099:
100: if (artifactId != null ? !artifactId.equals(pattern.artifactId)
101: : pattern.artifactId != null)
102: return false;
103: if (groupId != null ? !groupId.equals(pattern.groupId)
104: : pattern.groupId != null)
105: return false;
106: if (module != null ? !module.equals(pattern.module)
107: : pattern.module != null)
108: return false;
109: if (name != null ? !name.equals(pattern.name)
110: : pattern.name != null)
111: return false;
112: if (type != null ? !type.equals(pattern.type)
113: : pattern.type != null)
114: return false;
115: if (version != null ? !version.equals(pattern.version)
116: : pattern.version != null)
117: return false;
118:
119: return true;
120: }
121:
122: public int hashCode() {
123: int result;
124: result = (groupId != null ? groupId.hashCode() : 0);
125: result = 29 * result
126: + (artifactId != null ? artifactId.hashCode() : 0);
127: result = 29 * result
128: + (version != null ? version.hashCode() : 0);
129: result = 29 * result + (module != null ? module.hashCode() : 0);
130: result = 29 * result + (name != null ? name.hashCode() : 0);
131: result = 29 * result + (type != null ? type.hashCode() : 0);
132: return result;
133: }
134: }
|