Class Extension

  • All Implemented Interfaces:
    Serializable

    public class Extension
    extends Object
    implements Serializable
    An Extension can either be of type
    • Artifacts : it contains a list of artifacts
    • Text : it contains text
    • JSON : it contains a blob of JSON

    An extension can be in one of these states

    • Required : Required extensions need to be processed by tooling
    • Optional : Optional extensions might be processed by tooling, for example they might contain environment specific parts
    • Transient: Transient extensions are cache like extensions where tooling can store additional information to avoid reprocessing of down stream tooling. However such tooling must work without the transient extension being available.

    This class is not thread-safe.

    See Also:
    ExtensionType, Serialized Form
    • Constructor Detail

      • Extension

        public Extension​(ExtensionType type,
                         String name,
                         ExtensionState state)
        Create a new extension
        Parameters:
        type - The type of the extension
        name - The name of the extension
        state - The state of the extension
        Throws:
        IllegalArgumentException - If name, type or state is null
        Since:
        1.1
    • Method Detail

      • getType

        public ExtensionType getType()
        Get the extension type
        Returns:
        The type
      • getState

        public ExtensionState getState()
        Get the extension state
        Returns:
        The state
        Since:
        1.1
      • getName

        public String getName()
        Get the extension name
        Returns:
        The name
      • getText

        public String getText()
        Get the text of the extension
        Returns:
        The text
        Throws:
        IllegalStateException - if the type is not ExtensionType#TEXT
      • setText

        public void setText​(String text)
        Set the text of the extension
        Parameters:
        text - The text
        Throws:
        IllegalStateException - if the type is not ExtensionType#TEXT
      • getJSON

        public String getJSON()
        Get the JSON of the extension
        Returns:
        The JSON or null
        Throws:
        IllegalStateException - if the type is not ExtensionType#JSON
      • getJSONStructure

        public jakarta.json.JsonStructure getJSONStructure()
        Get the JSON structure of the extension
        Returns:
        The JSON object or null
        Throws:
        IllegalStateException - if the type is not ExtensionType#JSON
        Since:
        1.1
      • setJSONStructure

        public void setJSONStructure​(jakarta.json.JsonStructure struct)
        Set the JSON structure of the extension
        Parameters:
        struct - The JSON structure
        Throws:
        IllegalStateException - if the type is not ExtensionType#JSON
        IllegalArgumentException - If the structure is not valid
        Since:
        1.1
      • getArtifacts

        public Artifacts getArtifacts()
        Get the artifacts of the extension
        Returns:
        The artifacts
        Throws:
        IllegalStateException - if the type is not ExtensionType#ARTIFACTS
      • copy

        public Extension copy()
        Create a copy of the Extension
        Returns:
        A copy of the Extension
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object