Class Artifact

    • Field Detail

      • KEY_ALIAS

        public static final String KEY_ALIAS
        Can be used in artifact metadata to specify an alias. Multiple aliases can be comma-separated.
        See Also:
        Constant Field Values
      • KEY_START_ORDER

        public static final String KEY_START_ORDER
        This key might be used by bundles to define the start order.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Artifact

        public Artifact​(jakarta.json.JsonValue json)
        Construct a new artifact
        Parameters:
        json - The json for the artifact
        Throws:
        IllegalArgumentException - If json is null or wrongly formatted.
        Since:
        1.4
    • Method Detail

      • getId

        public ArtifactId getId()
        Get the id of the artifact.
        Returns:
        The id.
      • getMetadata

        public Map<String,​String> getMetadata()
        Get the metadata of the artifact. The metadata can be modified.
        Returns:
        The metadata.
      • getAliases

        public Set<ArtifactId> getAliases​(boolean includeMain)
        Obtain the alias or aliases for the artifact.
        Parameters:
        includeMain - Whether to include the main ID in the result.
        Returns:
        The aliases or an empty set if there are none.
      • getStartOrder

        public int getStartOrder()
        Get the start order of the artifact. This is a convenience method which gets the value for the property named #KEY_START_ORDER from the metadata.
        Returns:
        The start order, if no start order is defined, 0 is returned.
        Throws:
        NumberFormatException - If the stored metadata is not a number
        IllegalStateException - If the stored metadata is a negative number
      • setStartOrder

        public void setStartOrder​(int startOrder)
        Set the start order of the artifact This is a convenience method which sets the value of the property named #KEY_START_ORDER from the metadata.
        Parameters:
        startOrder - The start order
        Throws:
        IllegalArgumentException - If the number is negative
      • getFeatureOrigins

        public ArtifactId[] getFeatureOrigins()
        Get the feature origins - if recorded
        Returns:
        A array of feature artifact ids - array might be empty
        Throws:
        IllegalArgumentException - If the stored values are not valid artifact ids
      • getFeatureOrigins

        public ArtifactId[] getFeatureOrigins​(ArtifactId self)
        Get the feature origins If no origins are recorded, the provided artifact id is returned
        Parameters:
        self - The id of the current feature
        Returns:
        An array of feature artifact ids
        Throws:
        IllegalArgumentException - If the stored values are not valid artifact ids
        Since:
        1.7.0
      • setFeatureOrigins

        public void setFeatureOrigins​(ArtifactId... featureOrigins)
        Set the feature origins
        Parameters:
        featureOrigins - the array of artifact ids or null to remove the info from this object
      • hashCode

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

        public Artifact copy​(ArtifactId id)
        Create a copy of the artifact with a different id
        Parameters:
        id - The new id
        Returns:
        The copy of the feature with the new id