]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.api/src/org/argeo/slc/NameVersion.java
Upgrade all classpaths to Java 11
[gpl/argeo-slc.git] / org.argeo.slc.api / src / org / argeo / slc / NameVersion.java
1 package org.argeo.slc;
2
3 /**
4 * Abstraction of a name / version pair, typically used as coordinates for a
5 * software module either deployed or packaged as an archive.
6 */
7 public interface NameVersion {
8 /** The name of the component. */
9 String getName();
10
11 /** The version of the component. */
12 String getVersion();
13
14 /**
15 * The forward compatible branch of this version, by default it is
16 * [major].[minor].
17 */
18 default String getBranch() {
19 String[] parts = getVersion().split("\\.");
20 if (parts.length < 2)
21 throw new IllegalStateException("Version " + getVersion() + " cannot be interpreted as branch.");
22 return parts[0] + "." + parts[1];
23 }
24 }