Class 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 Detail

      • ServiceId

        public ServiceId()
    • 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" as toString() 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
      • toString

        public final String toString()
        Returns a service id in the following format: "groupId:artifactId:version".
        Overrides:
        toString in class Object