Package com.exonum.binding.runtime
Class ServiceId
- java.lang.Object
-
- com.exonum.binding.runtime.ServiceId
-
public abstract class ServiceId extends java.lang.ObjectA 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
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.StringgetArtifactId()Returns the artifact id of this service (e.g., "land-registry"), aka service name.abstract java.lang.StringgetGroupId()Returns the group id of this service (e.g., "com.acme").abstract java.lang.StringgetVersion()Returns the version of this service (e.g., "1.2.0").static ServiceIdof(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)Creates a new service id of the given coordinate.static ServiceIdparseFrom(java.lang.String serviceId)Parses a service id in format "groupId:artifactId:version" astoString()produces.java.lang.StringtoString()Returns a service id in the following format: "groupId:artifactId:version".
-
-
-
Method Detail
-
getGroupId
public abstract java.lang.String getGroupId()
Returns the group id of this service (e.g., "com.acme").
-
getArtifactId
public abstract java.lang.String getArtifactId()
Returns the artifact id of this service (e.g., "land-registry"), aka service name.
-
getVersion
public abstract java.lang.String getVersion()
Returns the version of this service (e.g., "1.2.0").
-
parseFrom
public static ServiceId parseFrom(java.lang.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:
java.lang.IllegalArgumentException- if the format is not correct
-
of
public static ServiceId of(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
Creates a new service id of the given coordinate. Each coordinate may be empty.- Throws:
java.lang.IllegalArgumentException- if any coordinate contains forbidden characters: whitespace, colon
-
toString
public final java.lang.String toString()
Returns a service id in the following format: "groupId:artifactId:version".- Overrides:
toStringin classjava.lang.Object
-
-