X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.specs%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2FBasicNameVersion.java;h=73f12fc4a51b6e32fa2bdc3e430e522882158932;hb=6de9c4036be9e318f59a0ffa187570f5999c53cb;hp=9cefc940522b115ec849adff038d537ff4940ce9;hpb=16e2ffb035a4c41576acc74efb37610c7aec1887;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/BasicNameVersion.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/BasicNameVersion.java index 9cefc9405..73f12fc4a 100644 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/BasicNameVersion.java +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/BasicNameVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Mathieu Baudier + * 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. @@ -13,12 +13,10 @@ * 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, Serializable { private static final long serialVersionUID = -5127304279136195127L; @@ -28,6 +26,18 @@ public class BasicNameVersion implements NameVersion, Comparable, 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; @@ -80,5 +90,4 @@ public class BasicNameVersion implements NameVersion, Comparable, else return name.compareTo(o.getName()); } - }