Package org.spdx.utility.license
Class LicenseExpressionParser
- java.lang.Object
-
- org.spdx.utility.license.LicenseExpressionParser
-
public class LicenseExpressionParser extends Object
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 Modifier and Type Field Description static String
UNINITIALIZED_LICENSE_TEXT
-
Constructor Summary
Constructors Constructor Description LicenseExpressionParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.spdx.library.model.v3_0_1.simplelicensing.AnyLicenseInfo
parseLicenseExpression(String expression, org.spdx.storage.IModelStore store, String customLicenseUriPrefix, org.spdx.core.IModelCopyManager copyManager, List<org.spdx.library.model.v3_0_1.core.DictionaryEntry> customIdToUri)
Parses a license expression into an license for use in the Model using the SPDX Version 3.X modelstatic org.spdx.library.model.v2.license.AnyLicenseInfo
parseLicenseExpressionCompatV2(String expression, org.spdx.storage.IModelStore store, String documentUri, org.spdx.core.IModelCopyManager copyManager)
Parses a license expression into an license for use in the Model using the SPDX Version 2.X model
-
-
-
Field Detail
-
UNINITIALIZED_LICENSE_TEXT
public static final String UNINITIALIZED_LICENSE_TEXT
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseLicenseExpression
public static org.spdx.library.model.v3_0_1.simplelicensing.AnyLicenseInfo parseLicenseExpression(String expression, org.spdx.storage.IModelStore store, String customLicenseUriPrefix, @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 an 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.copyManager
- 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
-
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 an 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
-
-