]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/BasicNameVersion.java
9cefc940522b115ec849adff038d537ff4940ce9
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org
.argeo
.slc
;
19 import java
.io
.Serializable
;
22 public class BasicNameVersion
implements NameVersion
, Comparable
<NameVersion
>,
24 private static final long serialVersionUID
= -5127304279136195127L;
26 private String version
;
28 public BasicNameVersion() {
31 public BasicNameVersion(String name
, String version
) {
33 this.version
= version
;
36 public BasicNameVersion(NameVersion nameVersion
) {
37 this.name
= nameVersion
.getName();
38 this.version
= nameVersion
.getVersion();
41 public String
getName() {
45 public void setName(String name
) {
49 public String
getVersion() {
53 public void setVersion(String version
) {
54 this.version
= version
;
58 public boolean equals(Object obj
) {
59 if (obj
instanceof NameVersion
) {
60 NameVersion nameVersion
= (NameVersion
) obj
;
61 return name
.equals(nameVersion
.getName())
62 && version
.equals(nameVersion
.getVersion());
68 public int hashCode() {
69 return name
.hashCode() + version
.hashCode();
73 public String
toString() {
74 return name
+ ":" + version
;
77 public int compareTo(NameVersion o
) {
78 if (o
.getName().equals(name
))
79 return version
.compareTo(o
.getVersion());
81 return name
.compareTo(o
.getName());