Package org.spdx.library
Class ListedLicenses
- java.lang.Object
-
- org.spdx.library.ListedLicenses
-
public class ListedLicenses extends Object
Singleton class which holds the listed licenses- Author:
- Gary O'Neall
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getLicenseListVersion()
org.spdx.storage.IModelStore
getLicenseModelStore()
org.spdx.storage.IModelStore
getLicenseModelStoreCompatV2()
org.spdx.library.model.v3_0_1.expandedlicensing.ListedLicenseException
getListedExceptionById(String exceptionId)
org.spdx.library.model.v2.license.ListedLicenseException
getListedExceptionByIdCompatV2(String exceptionId)
org.spdx.library.model.v3_0_1.expandedlicensing.ListedLicense
getListedLicenseById(String licenseId)
org.spdx.library.model.v2.license.SpdxListedLicense
getListedLicenseByIdCompatV2(String licenseId)
org.spdx.library.model.v3_0_1.core.CreationInfo
getListedLicenseCreationInfo()
static ListedLicenses
getListedLicenses()
List<String>
getSpdxListedExceptionIds()
List<String>
getSpdxListedLicenseIds()
boolean
isSpdxListedExceptionId(String exceptionId)
boolean
isSpdxListedLicenseId(String licenseId)
Optional<String>
listedExceptionIdCaseSensitive(String exceptionId)
Optional<String>
listedLicenseIdCaseSensitive(String licenseId)
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.
-
-
-
Method Detail
-
getListedLicenses
public static ListedLicenses getListedLicenses()
-
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
-
getListedLicenseByIdCompatV2
public org.spdx.library.model.v2.license.SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
licenseId
- SPDX Listed License ID- Returns:
- an SPDX spec version 2 SPDX listed license or null if the ID is not in the SPDX license list
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getListedExceptionByIdCompatV2
public org.spdx.library.model.v2.license.ListedLicenseException getListedExceptionByIdCompatV2(String exceptionId) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
exceptionId
- SPDX Listed License Exception ID- Returns:
- an SPDX spec version 2 SPDX listed license exception or null if the ID is not in the SPDX license list
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getListedLicenseById
public org.spdx.library.model.v3_0_1.expandedlicensing.ListedLicense getListedLicenseById(String licenseId) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
licenseId
- SPDX Listed License ID- Returns:
- SPDX listed license or null if the ID is not in the SPDX license list
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getListedExceptionById
public org.spdx.library.model.v3_0_1.expandedlicensing.ListedLicenseException getListedExceptionById(String exceptionId) throws org.spdx.core.InvalidSPDXAnalysisException
- Throws:
org.spdx.core.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 org.spdx.storage.IModelStore getLicenseModelStore()
- Returns:
- model store for listed licenses using the version 3 SPDX model
-
getLicenseModelStoreCompatV2
public org.spdx.storage.IModelStore getLicenseModelStoreCompatV2()
-
getListedLicenseCreationInfo
public org.spdx.library.model.v3_0_1.core.CreationInfo getListedLicenseCreationInfo() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the CreationInfo used for all SPDX listed licenses and listed exceptions
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
- on error inflating the creation info
-
-