Class ComponentSpecification

java.lang.Object
com.yahoo.component.ComponentSpecification

public final class ComponentSpecification extends Object
The specification of a wanted component. Consists of a name, optionally a version specification, and optionally a namespace. This is an immutable value object
Author:
Arne Bergene Fossaa, Tony Vaagenes
  • Constructor Details

    • ComponentSpecification

      public ComponentSpecification(String name, VersionSpecification versionSpecification, ComponentId namespace)
    • ComponentSpecification

      public ComponentSpecification(String name, VersionSpecification versionSpec)
      Creates a component id from a name and version. The version may be null
    • ComponentSpecification

      public ComponentSpecification(String id)
      Creates a component id from the id string form: name(:version?), where version has the form 1(.2(.3(.identifier)?)?)?
  • Method Details

    • fromString

      public static ComponentSpecification fromString(String componentSpecification)
      Creates a component id from the id string form: name(:version?), where version has the form 1(.2(.3(.identifier)?)?)?
      Returns:
      null iff componentSpecification == null
    • nestInNamespace

      public ComponentSpecification nestInNamespace(ComponentId namespace)
    • getNamespace

      public ComponentId getNamespace()
      The namespace is null if this is to match a top level component id
    • getName

      public String getName()
      Returns the name of this. This is never null
    • getVersionSpecification

      public VersionSpecification getVersionSpecification()
      Returns the version of this id, or null if no version is specified
    • stringValue

      public String stringValue()
      Returns the string value of this id. If no version is given, this is simply the name. If a version is given, it is name:version. Trailing ".0"'s are stripped from the version part.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toId

      public ComponentId toId()
      Converts the specification to an id
    • matches

      public boolean matches(ComponentId id)
      Checks if a componentId matches a given spec
    • intersect

    • withoutNamespace

      public ComponentSpecification withoutNamespace()
      Returns a copy of this spec with namespace set to null