Class ServiceArtifactId

java.lang.Object
com.exonum.binding.common.runtime.ServiceArtifactId

public abstract class ServiceArtifactId
extends java.lang.Object
A service artifact identifier. It consists of the runtime id in which the service shall be deployed, the service artifact name and its version.

The extensions of this class must be immutable and hence thread-safe.

  • Constructor Summary

    Constructors 
    Constructor Description
    ServiceArtifactId()  
  • Method Summary

    Modifier and Type Method Description
    static ServiceArtifactId fromProto​(Base.ArtifactId artifactId)
    Creates a new service artifact from the given artifact id message.
    abstract java.lang.String getName()
    Returns the artifact name of this service.
    abstract int getRuntimeId()
    Returns the runtime id in which the service shall be deployed.
    abstract java.lang.String getVersion()
    Returns the artifact version of this service (e.g., "1.2.0").
    static ServiceArtifactId newJavaId​(java.lang.String name, java.lang.String version)
    Creates a new service artifact id of a Java artifact.
    static ServiceArtifactId parseFrom​(java.lang.String serviceArtifactId)
    Parses a service id in format "runtimeId:serviceName:version" as toString() produces.
    java.lang.String toString()
    Returns an artifact id in the following format: "runtimeId:serviceName:version".
    static ServiceArtifactId valueOf​(int runtimeId, java.lang.String name, java.lang.String version)
    Creates a new service artifact id.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • getRuntimeId

      public abstract int getRuntimeId()
      Returns the runtime id in which the service shall be deployed.
    • getName

      public abstract java.lang.String getName()
      Returns the artifact name of this service. The name of Java artifacts usually (but not necessary) contains the two coordinates: groupId and artifactId separated by "/" (e.g., "com.acme/land-registry").
    • getVersion

      public abstract java.lang.String getVersion()
      Returns the artifact version of this service (e.g., "1.2.0").
    • parseFrom

      public static ServiceArtifactId parseFrom​(java.lang.String serviceArtifactId)
      Parses a service id in format "runtimeId:serviceName:version" as toString() produces.
      Parameters:
      serviceArtifactId - a string in format "runtimeId:serviceName:version". Whitespace characters, including preceding and trailing, are not allowed
      Returns:
      a ServiceArtifactId with the given coordinates
      Throws:
      java.lang.IllegalArgumentException - if the format is not correct
    • newJavaId

      public static ServiceArtifactId newJavaId​(java.lang.String name, java.lang.String version)
      Creates a new service artifact id of a Java artifact.
      Parameters:
      name - the name of the service; must not be blank
    • valueOf

      public static ServiceArtifactId valueOf​(int runtimeId, java.lang.String name, java.lang.String version)
      Creates a new service artifact id.
      Parameters:
      runtimeId - the runtime id in which the service shall be deployed
      name - the name of the service; must not be blank
    • fromProto

      public static ServiceArtifactId fromProto​(Base.ArtifactId artifactId)
      Creates a new service artifact from the given artifact id message.
    • toString

      public final java.lang.String toString()
      Returns an artifact id in the following format: "runtimeId:serviceName:version".
      Overrides:
      toString in class java.lang.Object