# Klasse License

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.ant.cyclonedx.License

Alle implementierten Schnittstellen:
  `Cloneable`

public class License extends org.apache.tools.ant.types.DataType
A license element to be attached to a component.

Licenses are required to have an id or a name attribute. Due to Ant's own usage of the `id` attribute the SBOM id of the license is called `licenseId` here.

The CycloneDX specification supports more information for a license than this type currently exposes.

This class is a type exposed by this Ant Library. When using the inherited `refid` attribute it can reference an instance defined previously - in which case no child elements or other attributes are allowed.

- ## Feldübersicht

  ### Von Klasse geerbte Felder org.apache.tools.ant.types.DataType

  `checked, ref`

  ### Von Klasse geerbte Felder org.apache.tools.ant.ProjectComponent

  `description, location, project`

- ## Konstruktorübersicht

  Konstruktoren
  Konstruktor
  Beschreibung
  `License()`

- ## Methodenübersicht

  Modifikator und Typ
  Methode
  Beschreibung
  `void`
  `addConfiguredUrl(org.apache.tools.ant.types.resources.URLResource url)`
  Sets the url of the license.
  `protected License`
  `getRef()`
  Perform the check for circular references and return the referenced License.
  `void`
  `setLicenseId(String id)`
  Sets the `id` of the license.
  `void`
  `setName(String name)`
  Sets the name of the license.
  `org.cyclonedx.model.License`
  `toCycloneDxLicense()`
  Maps the license to its CycloneDX counterpart.

  ### Von Klasse geerbte Methoden org.apache.tools.ant.types.DataType

  `checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, setRefid, tooManyAttributes, toString`

  ### Von Klasse geerbte Methoden org.apache.tools.ant.ProjectComponent

  `getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`

  ### Von Klasse geerbte Methoden Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Konstruktordetails

  - ### License

    public License()

- ## Methodendetails

  - ### setLicenseId

    public void setLicenseId(String id)
    Sets the `id` of the license.

    Must be a valid SPDX identifier. This library doesn't enforce the SPDX identifier but the CycloneDX Core library does.

    Parameter:
      `id` - SPDX id of license

  - ### setName

    public void setName(String name)
    Sets the name of the license.
    Parameter:
      `name` - license name

  - ### addConfiguredUrl

    public void addConfiguredUrl(org.apache.tools.ant.types.resources.URLResource url)
    Sets the url of the license.

    Even though this is a nested element of the license element, at most one child is allowed.

    Parameter:
      `url` - url of license

  - ### toCycloneDxLicense

    public org.cyclonedx.model.License toCycloneDxLicense()
    Maps the license to its CycloneDX counterpart.
    Gibt zurück:
      CycloneDX version of this instance

  - ### getRef

    protected License getRef()
    Perform the check for circular references and return the referenced License.
    Gibt zurück:
      `License`.