Class ExceptionJson
java.lang.Object
org.spdx.storage.listedlicense.ExceptionJson
Simple POJO to hold the license exception data loaded from a JSON file
Licenses in the JSON format can be found at spdx.org/licenses/[exceptionid].json
- Author:
- Gary O'Neall
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List<org.spdx.storage.PropertyDescriptor> All property descriptors for ExceptionsMap of property descriptors to the value name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddPrimitiveValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value) voidaddValueToList(String propertyName, String valueId, String type) voidclearPropertyValueList(org.spdx.storage.PropertyDescriptor propertyDescriptor) Clears a list of values for a propertyvoidcopyFrom(org.spdx.library.model.v2.license.ListedLicenseException fromException) Copies from an SPDX version 2 exceptionvoidcopyFrom(org.spdx.library.model.v3_0_1.expandedlicensing.ListedLicenseException fromException) Copies all properties from an exceptionList<org.spdx.storage.PropertyDescriptor> getValue(org.spdx.storage.PropertyDescriptor propertyDescriptor) 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) Removes the propertyvoidsetPrimitiveValue(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value) voidsetTypedProperty(String propertyName, String valueId, String type)
-
Field Details
-
ALL_PROPERTY_DESCRIPTORS
All property descriptors for Exceptions -
PROPERTY_DESCRIPTOR_TO_VALUE_NAME
-
-
Constructor Details
-
ExceptionJson
-
ExceptionJson
public ExceptionJson()Create an ExceptionJson
-
-
Method Details
-
setTypedProperty
public void setTypedProperty(String propertyName, String valueId, String type) throws org.spdx.core.InvalidSpdxPropertyException - Parameters:
propertyName- property namevalueId- ID for the valuetype- SPDX type- Throws:
org.spdx.core.InvalidSpdxPropertyException- on invalid type for the SPDX property
-
setPrimitiveValue
public void setPrimitiveValue(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value) throws org.spdx.core.InvalidSpdxPropertyException - Parameters:
propertyDescriptor- descriptor for the property to be setvalue- value to set- Throws:
org.spdx.core.InvalidSpdxPropertyException- on invalid property
-
clearPropertyValueList
public void clearPropertyValueList(org.spdx.storage.PropertyDescriptor propertyDescriptor) throws org.spdx.core.InvalidSpdxPropertyException Clears a list of values for a property- Parameters:
propertyDescriptor- descriptor for the property- Throws:
org.spdx.core.InvalidSpdxPropertyException- if it is not a list type
-
addValueToList
public void addValueToList(String propertyName, String valueId, String type) throws org.spdx.core.InvalidSpdxPropertyException - Parameters:
propertyName- Name of the propertyvalueId- ID for the valuetype- SPDX type- Throws:
org.spdx.core.InvalidSpdxPropertyException- on invalid type to add a value
-
addPrimitiveValueToList
public boolean addPrimitiveValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value) throws org.spdx.core.InvalidSpdxPropertyException - Parameters:
propertyDescriptor- descriptor for the propertyvalue- Value to set- Returns:
- true if the value was added
- Throws:
org.spdx.core.InvalidSpdxPropertyException- on SPDX parsing errors
-
getValueList
public List<?> getValueList(org.spdx.storage.PropertyDescriptor propertyDescriptor) throws org.spdx.core.InvalidSpdxPropertyException - Parameters:
propertyDescriptor- descriptor for the property- Returns:
- list of values associated with the property
- Throws:
org.spdx.core.InvalidSpdxPropertyException- if the propertyDescriptor is not for a list type
-
getValue
public Object getValue(org.spdx.storage.PropertyDescriptor propertyDescriptor) throws org.spdx.core.InvalidSpdxPropertyException - Parameters:
propertyDescriptor- descriptor for the property- Returns:
- Value associated with the property or null if no value was set
- Throws:
org.spdx.core.InvalidSpdxPropertyException- if the property descriptor is not valid
-
removeProperty
public void removeProperty(org.spdx.storage.PropertyDescriptor propertyDescriptor) throws org.spdx.core.InvalidSpdxPropertyException Removes the property- Parameters:
propertyDescriptor- descriptor for the property- Throws:
org.spdx.core.InvalidSpdxPropertyException- if the property descriptor is not valid
-
copyFrom
public void copyFrom(org.spdx.library.model.v3_0_1.expandedlicensing.ListedLicenseException fromException) throws org.spdx.core.InvalidSPDXAnalysisException Copies all properties from an exception- Parameters:
fromException- exception to copy from- Throws:
org.spdx.core.InvalidSPDXAnalysisException- on error getting values from the exception
-
copyFrom
public void copyFrom(org.spdx.library.model.v2.license.ListedLicenseException fromException) throws org.spdx.core.InvalidSPDXAnalysisException Copies from an SPDX version 2 exception- Parameters:
fromException- exception to copy from- Throws:
org.spdx.core.InvalidSPDXAnalysisException- on error getting values from the exception
-
removePrimitiveValueToList
public boolean removePrimitiveValueToList(org.spdx.storage.PropertyDescriptor propertyDescriptor, Object value) throws org.spdx.core.InvalidSpdxPropertyException - Parameters:
propertyDescriptor- descriptor for the propertyvalue- value to remove- Returns:
- true if the collection was modified
- Throws:
org.spdx.core.InvalidSpdxPropertyException- if the propertyDescriptor is not valid
-
isPropertyValueAssignableTo
public boolean isPropertyValueAssignableTo(org.spdx.storage.PropertyDescriptor propertyDescriptor, Class<?> clazz) throws org.spdx.core.InvalidSpdxPropertyException - Parameters:
propertyDescriptor- descriptor for the propertyclazz- class to test assignability- Returns:
- true if the propertyDescriptor can be assigned a value of type clazz
- Throws:
org.spdx.core.InvalidSpdxPropertyException- if the propertyDescriptor is not valid
-
isCollectionMembersAssignableTo
public static boolean isCollectionMembersAssignableTo(org.spdx.storage.PropertyDescriptor propertyDescriptor, Class<?> clazz) - Parameters:
propertyDescriptor- descriptor for the propertyclazz- class to test assignability- Returns:
- true if the list associated with the propertyDescriptor have a value added of type clazz
-
isCollectionProperty
public boolean isCollectionProperty(org.spdx.storage.PropertyDescriptor propertyDescriptor) - Parameters:
propertyDescriptor- descriptor for the property- Returns:
- true if the property represents a collection
-
getPropertyValueDescriptors
- Returns:
- all present property descriptors
-