]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.api/src/org/argeo/slc/NameVersion.java
Improve RT CMS configuration
[gpl/argeo-slc.git] / org.argeo.slc.api / src / org / argeo / slc / NameVersion.java
index 19060490a7efa84e01cb57da14c6916f4d9bc911..45ce5835dabc8977c7c9374d6fe5bb718f677aab 100644 (file)
@@ -6,8 +6,19 @@ package org.argeo.slc;
  */
 public interface NameVersion {
        /** The name of the component. */
-       public String getName();
+       String getName();
 
        /** The version of the component. */
-       public String getVersion();
+       String getVersion();
+
+       /**
+        * The forward compatible branch of this version, by default it is
+        * [major].[minor].
+        */
+       default String getBranch() {
+               String[] parts = getVersion().split("\\.");
+               if (parts.length < 2)
+                       throw new IllegalStateException("Version " + getVersion() + " cannot be interpreted as branch.");
+               return parts[0] + "." + parts[1];
+       }
 }