/*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
+ * Copyright (C) 2007-2012 Argeo GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.argeo.slc;
import java.io.Serializable;
-
public class BasicNameVersion implements NameVersion, Comparable<NameVersion>,
Serializable {
private static final long serialVersionUID = -5127304279136195127L;
public BasicNameVersion() {
}
+ /** Interprets string in OSGi-like format my.module.name;version=0.0.0 */
+ public BasicNameVersion(String nameVersion) {
+ int index = nameVersion.indexOf(";version=");
+ if (index < 0) {
+ name = nameVersion;
+ version = null;
+ } else {
+ name = nameVersion.substring(0, index);
+ version = nameVersion.substring(index + ";version=".length());
+ }
+ }
+
public BasicNameVersion(String name, String version) {
this.name = name;
this.version = version;
else
return name.compareTo(o.getName());
}
-
}