Package com.yahoo.component
Class ComponentSpecification
java.lang.Object
com.yahoo.component.ComponentSpecification
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 Summary
ConstructorDescriptionCreates a component id from the id string form: name(:version?), where version has the form 1(.2(.3(.identifier)?)?)?ComponentSpecification
(String name, VersionSpecification versionSpec) Creates a component id from a name and version.ComponentSpecification
(String name, VersionSpecification versionSpecification, ComponentId namespace) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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)?)?)?getName()
Returns the name of this.The namespace is null if this is to match a top level component idReturns the version of this id, or null if no version is specifiedint
hashCode()
intersect
(ComponentSpecification other) boolean
matches
(ComponentId id) Checks if a componentId matches a given specnestInNamespace
(ComponentId namespace) Returns the string value of this id.toId()
Converts the specification to an idtoString()
Returns a copy of this spec with namespace set to null
-
Constructor Details
-
ComponentSpecification
public ComponentSpecification(String name, VersionSpecification versionSpecification, ComponentId namespace) -
ComponentSpecification
Creates a component id from a name and version. The version may be null -
ComponentSpecification
Creates a component id from the id string form: name(:version?), where version has the form 1(.2(.3(.identifier)?)?)?
-
-
Method Details
-
fromString
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
-
getNamespace
The namespace is null if this is to match a top level component id -
getName
Returns the name of this. This is never null -
getVersionSpecification
Returns the version of this id, or null if no version is specified -
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
-
equals
-
hashCode
public int hashCode() -
toId
Converts the specification to an id -
matches
Checks if a componentId matches a given spec -
intersect
-
withoutNamespace
Returns a copy of this spec with namespace set to null
-