]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/BasicNameVersion.java
c01c5da5e14b1e53a12ac6f1ac2e92cef7027dd6
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
.build
;
19 import java
.io
.Serializable
;
21 public class BasicNameVersion
implements NameVersion
, Comparable
<NameVersion
>,
23 private static final long serialVersionUID
= -5127304279136195127L;
25 private String version
;
27 public BasicNameVersion() {
30 public BasicNameVersion(String name
, String version
) {
32 this.version
= version
;
35 public BasicNameVersion(NameVersion nameVersion
) {
36 this.name
= nameVersion
.getName();
37 this.version
= nameVersion
.getVersion();
40 public String
getName() {
44 public void setName(String name
) {
48 public String
getVersion() {
52 public void setVersion(String version
) {
53 this.version
= version
;
57 public boolean equals(Object obj
) {
58 if (obj
instanceof NameVersion
) {
59 NameVersion nameVersion
= (NameVersion
) obj
;
60 return name
.equals(nameVersion
.getName())
61 && version
.equals(nameVersion
.getVersion());
67 public int hashCode() {
68 return name
.hashCode() + version
.hashCode();
72 public String
toString() {
73 return name
+ ":" + version
;
76 public int compareTo(NameVersion o
) {
77 if (o
.getName().equals(name
))
78 return version
.compareTo(o
.getVersion());
80 return name
.compareTo(o
.getName());