Class Link

All Implemented Interfaces:
dev.metaschema.core.model.IBoundObject, ILink

@MetaschemaAssembly(formalName="Link", description="A reference to a local or remote resource, that has a specific relation to the containing object.", name="link", moduleClass=OscalMetadataModule.class, remarks="To provide a cryptographic hash for a remote target resource, a local reference to a back matter `resource` is needed. The resource allows one or more hash values to be provided using the `rlink/hash` object.\n\nThe OSCAL `link` is a roughly based on the HTML [link element](https://www.w3.org/TR/html401/struct/links.html#edef-LINK).", valueConstraints=@ValueConstraints(indexHasKey=@IndexHasKey(id="oscal-metadata-link-reference-index-back-matter-resource",level=ERROR,target=".[@rel=(\'reference\') and starts-with(@href,\'#\')]",indexName="index-back-matter-resource",keyFields=@KeyField(target="@href",pattern="#(.*)")),matches={@Matches(id="oscal-metadata-link-reference-href-datatype-uri-reference",level=ERROR,target=".[@rel=(\'reference\') and starts-with(@href,\'#\')]/@href",typeAdapter=dev.metaschema.core.datatype.adapter.UriReferenceAdapter.class),@Matches(id="oscal-metadata-link-reference-href-datatype-uri",level=ERROR,target=".[@rel=(\'reference\') and not(starts-with(@href,\'#\'))]/@href",typeAdapter=dev.metaschema.core.datatype.adapter.UriAdapter.class),@Matches(id="oscal-metadata-link-resource-fragment-datatype",level=ERROR,target="@resource-fragment",pattern="(?:[0-9a-zA-Z-._~/?!$&\'()*+,;=:@]|%[0-9A-F][0-9A-F])+",remarks="This pattern is based on the fragment Augmented Backus-Naur form (ABNF) syntax provided in \\[RFC3986 section 3.5\\](https://www.rfc-editor.org/rfc/rfc3986#section-3.5). Uppercase alpha hex digits are required, which is the preferred normalized form defined in RFC3986.")},expect=@Expect(id="oscal-metadata-link-uri-reference-no-media-type",description="A local reference SHOULD NOT have a media-type.",level=ERROR,target=".[starts-with(@href,\'#\')]",test="not(exists(@media-type))",remarks="Since both `link` and `back-matter/resource` both allow specification of a `media-type`, the `media-type` on `link` may conflict with the any `media-type` entries on a resource\'s `rlink` or `base64` objects. This constraint prevents this from occurring."))) public class Link extends AbstractLink implements dev.metaschema.core.model.IBoundObject
A reference to a local or remote resource, that has a specific relation to the containing object.
  • Constructor Details

    • Link

      public Link()
      Constructs a new dev.metaschema.oscal.lib.model.Link instance with no metadata.
    • Link

      public Link(dev.metaschema.core.model.IMetaschemaData data)
      Constructs a new dev.metaschema.oscal.lib.model.Link instance with the specified metadata.
      Parameters:
      data - the metaschema data, or null if none
  • Method Details

    • getMetaschemaData

      public dev.metaschema.core.model.IMetaschemaData getMetaschemaData()
      Specified by:
      getMetaschemaData in interface dev.metaschema.core.model.IBoundObject
    • getHref

      @NonNull public URI getHref()
      Get the "Hypertext Reference".

      A resolvable URL reference to a resource.

      Returns:
      the href value
    • setHref

      public void setHref(@NonNull URI value)
      Set the "Hypertext Reference".

      A resolvable URL reference to a resource.

      Parameters:
      value - the href value to set
    • getRel

      @Nullable public String getRel()
      Get the "Link Relation Type".

      Describes the type of relationship provided by the link's hypertext reference. This can be an indicator of the link's purpose.

      Returns:
      the rel value, or null if not set
    • setRel

      public void setRel(@Nullable String value)
      Set the "Link Relation Type".

      Describes the type of relationship provided by the link's hypertext reference. This can be an indicator of the link's purpose.

      Parameters:
      value - the rel value to set, or null to clear
    • getMediaType

      @Nullable public String getMediaType()
      Get the "Link Media Type".

      A label that indicates the nature of a resource, as a data serialization or format.

      Returns:
      the media-type value, or null if not set
    • setMediaType

      public void setMediaType(@Nullable String value)
      Set the "Link Media Type".

      A label that indicates the nature of a resource, as a data serialization or format.

      Parameters:
      value - the media-type value to set, or null to clear
    • getResourceFragment

      @Nullable public String getResourceFragment()
      Get the "Resource Fragment".

      In case where the href points to a back-matter/resource, this value will indicate the URI fragment to append to any rlink associated with the resource. This value MUST be URI encoded.

      Returns:
      the resource-fragment value, or null if not set
    • setResourceFragment

      public void setResourceFragment(@Nullable String value)
      Set the "Resource Fragment".

      In case where the href points to a back-matter/resource, this value will indicate the URI fragment to append to any rlink associated with the resource. This value MUST be URI encoded.

      Parameters:
      value - the resource-fragment value to set, or null to clear
    • getText

      @Nullable public dev.metaschema.core.datatype.markup.MarkupLine getText()
      Get the "Link Text".

      A textual label to associate with the link, which may be used for presentation in a tool.

      Returns:
      the text value, or null if not set
    • setText

      public void setText(@Nullable dev.metaschema.core.datatype.markup.MarkupLine value)
      Set the "Link Text".

      A textual label to associate with the link, which may be used for presentation in a tool.

      Parameters:
      value - the text value to set, or null to clear
    • toString

      public String toString()
      Overrides:
      toString in class Object