Class LicenseExpressionParser
java.lang.Object
org.spdx.utility.license.LicenseExpressionParser
A parser for the SPDX License Expressions as documented in the SPDX appendix
This is a static help class. The primary method is parseLicenseExpression which returns an AnyLicenseInfo.
- Author:
- Gary O'Neall
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.spdx.library.model.v3_0_1.simplelicensing.AnyLicenseInfoparseLicenseExpression(String expression, org.spdx.storage.IModelStore store, String customLicenseUriPrefix, org.spdx.library.model.v3_0_1.core.CreationInfo creationInfo, org.spdx.core.IModelCopyManager copyManager, List<org.spdx.library.model.v3_0_1.core.DictionaryEntry> customIdToUri) Parses a license expression into n license for use in the Model using the SPDX Version 3.X modelstatic org.spdx.library.model.v2.license.AnyLicenseInfoparseLicenseExpressionCompatV2(String expression, org.spdx.storage.IModelStore store, String documentUri, org.spdx.core.IModelCopyManager copyManager) Parses a license expression into n license for use in the Model using the SPDX Version 2.X model
-
Field Details
-
UNINITIALIZED_LICENSE_TEXT
- See Also:
-
-
Constructor Details
-
LicenseExpressionParser
public LicenseExpressionParser()
-
-
Method Details
-
parseLicenseExpression
public static org.spdx.library.model.v3_0_1.simplelicensing.AnyLicenseInfo parseLicenseExpression(String expression, org.spdx.storage.IModelStore store, String customLicenseUriPrefix, org.spdx.library.model.v3_0_1.core.CreationInfo creationInfo, @Nullable org.spdx.core.IModelCopyManager copyManager, @Nullable List<org.spdx.library.model.v3_0_1.core.DictionaryEntry> customIdToUri) throws org.spdx.core.InvalidSPDXAnalysisException Parses a license expression into n license for use in the Model using the SPDX Version 3.X model- Parameters:
expression- Expression to be parsedstore- Store containing any extractedLicenseInfos - if any extractedLicenseInfos by ID already exist, they will be used. If none exist for an ID, they will be added. If null, the default model store will be used.customLicenseUriPrefix- Prefix for Object URI's created when appending custom license ID's or custom license additions. If any custom licenses or additions already exist, they will be used. If none exist for an ID, they will be added. If null, the default model document URI will be used.creationInfo- Creation information to use for newly created elementscopyManager- if non-null, allows for copying of any properties set which use other model stores or document URI'scustomIdToUri- Mapping of the id prefixes used in the license expression to the namespace preceding the external ID- Returns:
- the parsed license expression
- Throws:
org.spdx.core.InvalidSPDXAnalysisException- on SPDX parsing errors
-
parseLicenseExpressionCompatV2
public static org.spdx.library.model.v2.license.AnyLicenseInfo parseLicenseExpressionCompatV2(String expression, org.spdx.storage.IModelStore store, String documentUri, org.spdx.core.IModelCopyManager copyManager) throws org.spdx.core.InvalidSPDXAnalysisException Parses a license expression into n license for use in the Model using the SPDX Version 2.X model- Parameters:
expression- Expression to be parsedstore- Store containing any extractedLicenseInfos - if any extractedLicenseInfos by ID already exist, they will be used. If none exist for an ID, they will be added. If null, the default model store will be used.documentUri- Document URI for the document containing any extractedLicenseInfos - if any extractedLicenseInfos by ID already exist, they will be used. If none exist for an ID, they will be added. If null, the default model document URI will be used.copyManager- if non-null, allows for copying of any properties set which use other model stores or document URI's- Returns:
- the parsed license expression
- Throws:
org.spdx.core.InvalidSPDXAnalysisException- on SPDX parsing errors
-