Class ListedLicenses

java.lang.Object
org.spdx.library.model.license.ListedLicenses

public class ListedLicenses extends Object
Singleton class which holds the listed licenses
Author:
Gary O'Neall
  • Method Details

    • getListedLicenses

      public static ListedLicenses getListedLicenses()
    • initializeListedLicenses

      public static ListedLicenses initializeListedLicenses(IListedLicenseStore licenseStore)
      Initializes the listed licenses singleton from a provided cache. This will ignore all configuration around fetching remote licenses.
      Parameters:
      licenseStore - a preconfigured licenseStore, see SpdxListedLicenseLocalStore for an example.
      Returns:
      a singleton instance
    • resetListedLicenses

      public static ListedLicenses resetListedLicenses()
      Resets all of the cached license information and reloads the license IDs NOTE: This method should be used with caution, it will negatively impact performance.
      Returns:
    • isSpdxListedLicenseId

      public boolean isSpdxListedLicenseId(String licenseId)
      Parameters:
      licenseId - case insensitive
      Returns:
      true if the licenseId belongs to an SPDX listed license
    • isSpdxListedExceptionId

      public boolean isSpdxListedExceptionId(String exceptionId)
      Parameters:
      exceptionId - case insensitive
      Returns:
      true if the exceptionId belongs to an SPDX listed exception
    • getListedLicenseById

      public SpdxListedLicense getListedLicenseById(String licenseId) throws InvalidSPDXAnalysisException
      Parameters:
      licenseId - SPDX Listed License ID
      Returns:
      SPDX listed license or null if the ID is not in the SPDX license list
      Throws:
      InvalidSPDXAnalysisException
    • getListedExceptionById

      public ListedLicenseException getListedExceptionById(String exceptionId) throws InvalidSPDXAnalysisException
      Throws:
      InvalidSPDXAnalysisException
    • getSpdxListedLicenseIds

      public List<String> getSpdxListedLicenseIds()
      Returns:
      List of all SPDX listed license IDs
    • getLicenseListVersion

      public String getLicenseListVersion()
      Returns:
      The version of the loaded license list in the form M.N, where M is the major release and N is the minor release. If no license list is loaded, returns SpdxListedLicenseModelStore.DEFAULT_LICENSE_LIST_VERSION.
    • getSpdxListedExceptionIds

      public List<String> getSpdxListedExceptionIds()
      Returns:
      list of SPDX exception IDs
    • listedLicenseIdCaseSensitive

      public Optional<String> listedLicenseIdCaseSensitive(String licenseId)
      Parameters:
      licenseId - case insensitive license ID
      Returns:
      the case sensitive license ID
    • listedExceptionIdCaseSensitive

      public Optional<String> listedExceptionIdCaseSensitive(String exceptionId)
      Parameters:
      exceptionId - case insensitive exception ID
      Returns:
      case sensitive ID
    • getLicenseModelStore

      public IModelStore getLicenseModelStore()
      Returns:
      model store for listed licenses