Package org.spdx.storage.listedlicense
Class LicenseJson
- java.lang.Object
-
- org.spdx.storage.listedlicense.LicenseJson
-
public class LicenseJson extends Object
Simple POJO to hold the license data loaded from a JSON fileLicenses in the JSON format can be found at spdx.org/licenses/[licenseid].json
- Author:
- Gary O'Neall
-
-
Constructor Summary
Constructors Constructor Description LicenseJson()LicenseJson(String id)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddCrossRefValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, CrossRefJson value)Add a cross-reference to a value listbooleanaddPrimitiveValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value)Add a primitive value to a value listvoidclearPropertyValueList(org.spdx.storage.PropertyDescriptor propertyDescriptor)voidcopyFrom(org.spdx.library.model.v2.license.SpdxListedLicense fromLicense)voidcopyFrom(org.spdx.library.model.v3_0_1.expandedlicensing.ListedLicense fromLicense)List<org.spdx.storage.PropertyDescriptor>getPropertyValueDescriptors()ObjectgetValue(org.spdx.storage.PropertyDescriptor descriptor)List<?>getValueList(org.spdx.storage.PropertyDescriptor propertyDescriptor)static booleanisCollectionMembersAssignableTo(org.spdx.storage.PropertyDescriptor propertyDescriptor, Class<?> clazz)booleanisCollectionProperty(org.spdx.storage.PropertyDescriptor propertyDescriptor)booleanisPropertyValueAssignableTo(org.spdx.storage.PropertyDescriptor propertyDescriptor, Class<?> clazz)booleanremovePrimitiveValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value)voidremoveProperty(org.spdx.storage.PropertyDescriptor propertyDescriptor)voidsetPrimitiveValue(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value)voidsetTypedProperty(String propertyName, String valueId, String type)
-
-
-
Constructor Detail
-
LicenseJson
public LicenseJson(String id)
-
LicenseJson
public LicenseJson()
-
-
Method Detail
-
setTypedProperty
public void setTypedProperty(String propertyName, String valueId, String type) throws org.spdx.core.InvalidSpdxPropertyException
- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
setPrimitiveValue
public void setPrimitiveValue(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value) throws org.spdx.core.InvalidSpdxPropertyException- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
clearPropertyValueList
public void clearPropertyValueList(org.spdx.storage.PropertyDescriptor propertyDescriptor) throws org.spdx.core.InvalidSpdxPropertyException- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
addCrossRefValueToList
public boolean addCrossRefValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, CrossRefJson value) throws org.spdx.core.InvalidSPDXAnalysisExceptionAdd a cross-reference to a value list- Parameters:
propertyDescriptor- descriptor for the propertyvalue- cross ref value to add- Returns:
- true as specified by
Collections.add - Throws:
org.spdx.core.InvalidSPDXAnalysisException- on SPDX parsing errors
-
addPrimitiveValueToList
public boolean addPrimitiveValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value) throws org.spdx.core.InvalidSPDXAnalysisExceptionAdd a primitive value to a value list- Parameters:
propertyDescriptor- descriptor for the propertyvalue- value to add to the list- Returns:
- true as specified by
Collections.add - Throws:
org.spdx.core.InvalidSPDXAnalysisException- on SPDX parsing errors
-
removePrimitiveValueToList
public boolean removePrimitiveValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value) throws org.spdx.core.InvalidSpdxPropertyException- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
getValueList
public List<?> getValueList(org.spdx.storage.PropertyDescriptor propertyDescriptor) throws org.spdx.core.InvalidSpdxPropertyException
- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
getValue
public Object getValue(org.spdx.storage.PropertyDescriptor descriptor) throws org.spdx.core.InvalidSpdxPropertyException
- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
removeProperty
public void removeProperty(org.spdx.storage.PropertyDescriptor propertyDescriptor) throws org.spdx.core.InvalidSpdxPropertyException- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
copyFrom
public void copyFrom(org.spdx.library.model.v3_0_1.expandedlicensing.ListedLicense fromLicense) throws org.spdx.core.InvalidSPDXAnalysisException- Parameters:
fromLicense- license to copy from- Throws:
org.spdx.core.InvalidSPDXAnalysisException- on error accessing license properties
-
copyFrom
public void copyFrom(org.spdx.library.model.v2.license.SpdxListedLicense fromLicense) throws org.spdx.licenseTemplate.InvalidLicenseTemplateException, org.spdx.core.InvalidSPDXAnalysisException- Throws:
org.spdx.licenseTemplate.InvalidLicenseTemplateExceptionorg.spdx.core.InvalidSPDXAnalysisException
-
isPropertyValueAssignableTo
public boolean isPropertyValueAssignableTo(org.spdx.storage.PropertyDescriptor propertyDescriptor, Class<?> clazz) throws org.spdx.core.InvalidSpdxPropertyException- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
isCollectionMembersAssignableTo
public static boolean isCollectionMembersAssignableTo(org.spdx.storage.PropertyDescriptor propertyDescriptor, Class<?> clazz) throws org.spdx.core.InvalidSpdxPropertyException- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
isCollectionProperty
public boolean isCollectionProperty(org.spdx.storage.PropertyDescriptor propertyDescriptor) throws org.spdx.core.InvalidSpdxPropertyException- Throws:
org.spdx.core.InvalidSpdxPropertyException
-
getPropertyValueDescriptors
public List<org.spdx.storage.PropertyDescriptor> getPropertyValueDescriptors()
- Returns:
- all present property descriptors
-
-