Package com.exonum.binding.runtime
Class ServiceId
- java.lang.Object
-
- com.exonum.binding.runtime.ServiceId
-
public abstract class ServiceId extends Object
A service artifact identifier. It consist of the three coordinates that usually identify any Java artifact: groupId, artifactId and version.The extensions of this class must be immutable and hence thread-safe.
-
-
Constructor Summary
Constructors Constructor Description ServiceId()
-
Method Summary
Modifier and Type Method Description abstract StringgetArtifactId()Returns the artifact id of this service (e.g., "land-registry"), aka service name.abstract StringgetGroupId()Returns the group id of this service (e.g., "com.acme").abstract StringgetVersion()Returns the version of this service (e.g., "1.2.0").static ServiceIdof(String groupId, String artifactId, String version)Creates a new service id of the given coordinate.static ServiceIdparseFrom(String serviceId)Parses a service id in format "groupId:artifactId:version" astoString()produces.StringtoString()Returns a service id in the following format: "groupId:artifactId:version".
-
-
-
Method Detail
-
getGroupId
public abstract String getGroupId()
Returns the group id of this service (e.g., "com.acme").
-
getArtifactId
public abstract String getArtifactId()
Returns the artifact id of this service (e.g., "land-registry"), aka service name.
-
getVersion
public abstract String getVersion()
Returns the version of this service (e.g., "1.2.0").
-
parseFrom
public static ServiceId parseFrom(String serviceId)
Parses a service id in format "groupId:artifactId:version" astoString()produces.- Parameters:
serviceId- a string in format "groupId:artifactId:version". Whitespace characters, including preceding and trailing, are not allowed- Returns:
- a ServiceId with the given coordinates
- Throws:
IllegalArgumentException- if the format is not correct
-
of
public static ServiceId of(String groupId, String artifactId, String version)
Creates a new service id of the given coordinate. Each coordinate may be empty.- Throws:
IllegalArgumentException- if any coordinate contains forbidden characters: whitespace, colon
-
-