Class LicenseJson


  • public class LicenseJson
    extends Object
    Simple POJO to hold the license data loaded from a JSON file Licenses in the JSON format can be found at spdx.org/licenses/[licenseid].json
    Author:
    Gary O'Neall
    • 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
      • setPrimativeValue

        public void setPrimativeValue​(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,
                                              org.spdx.storage.listedlicense.CrossRefJson value)
                                       throws org.spdx.core.InvalidSPDXAnalysisException
        Add a cross reference to a value list
        Parameters:
        propertyDescriptor -
        value -
        Returns:
        true as specified by Collections.add
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • addPrimitiveValueToList

        public boolean addPrimitiveValueToList​(org.spdx.storage.PropertyDescriptor propertyDescriptor,
                                               Object value)
                                        throws org.spdx.core.InvalidSPDXAnalysisException
        Add a primitive value to a value list
        Parameters:
        propertyDescriptor -
        value -
        Returns:
        true as specified by Collections.add
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • 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.InvalidLicenseTemplateException
        org.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 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