Package org.spdx.library.model.license
Class License
java.lang.Object
org.spdx.library.model.ModelObject
org.spdx.library.model.license.AnyLicenseInfo
org.spdx.library.model.license.SimpleLicensingInfo
org.spdx.library.model.license.License
- Direct Known Subclasses:
SpdxListedLicense
public abstract class License extends SimpleLicensingInfo
Describes a license
All licenses have an ID.
Subclasses should extend this class to add additional properties.
- Author:
- Gary O'Neall
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected List<String>_verify(Set<String> verifiedIds, String specVersion)Implementation of the specific verifications for this model objectbooleanequivalent(ModelObject compare, boolean ignoreExternalReferences)BooleangetFsfLibre()StringgetLicenseText()StringgetStandardLicenseHeader()StringgetStandardLicenseHeaderTemplate()StringgetStandardLicenseTemplate()booleanisDeprecated()booleanisFsfLibre()booleanisNotFsfLibre()booleanisOsiApproved()voidsetDeprecated(Boolean deprecated)voidsetFsfLibre(Boolean fsfLibre)voidsetLicenseText(String text)voidsetOsiApproved(Boolean osiApproved)voidsetStandardLicenseHeader(String standardLicenseHeader)voidsetStandardLicenseHeaderTemplate(String standardLicenseHeaderTemplate)voidsetStandardLicenseTemplate(String template)StringtoString()IModelStore.ModelUpdateupdateSetDeprecated(Boolean deprecated)Methods inherited from class org.spdx.library.model.license.SimpleLicensingInfo
getComment, getLicenseId, getName, getSeeAlso, setComment, setName, setSeeAlsoMethods inherited from class org.spdx.library.model.ModelObject
addPropertyValueToCollection, addValueToCollection, clearValueCollection, clearValueCollection, clone, copyFrom, createAnnotation, createByteOffsetPointer, createChecksum, createConjunctiveLicenseSet, createCreationInfo, createCrossRef, createDisjunctiveLicenseSet, createExternalDocumentRef, createExternalRef, createLineCharPointer, createPackage, createPackageVerificationCode, createRelationship, createSpdxFile, createSpdxSnippet, createStartEndPointer, enterCriticalSection, equals, equivalent, getAnyLicenseInfoPropertyValue, getBooleanPropertyValue, getCopyManager, getDocumentUri, getElementPropertyValue, getEnumPropertyValue, getId, getIntegerPropertyValue, getModelStore, getObjectPropertyValue, getObjectPropertyValue, getObjectPropertyValueCollection, getObjectPropertyValueSet, getPropertyValueNames, getStringCollection, getStringPropertyValue, getType, hashCode, idToIdType, isCollectionMembersAssignableTo, isStrict, leaveCriticalSection, removeProperty, removeProperty, removePropertyValueFromCollection, removePropertyValueFromCollection, replacePropertyValueCollection, setCopyManager, setPropertyValue, setPropertyValue, setStrict, toTypedValue, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verify, verifyCollection
-
Constructor Details
-
License
Open or create a model object with the default store and default document URI- Parameters:
id- ID for this object - must be unique within the SPDX document- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getLicenseText
- Returns:
- the text of the license
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setLicenseText
- Parameters:
text- the license text to set- Throws:
InvalidSPDXAnalysisException
-
getStandardLicenseHeader
- Returns:
- the standardLicenseHeader
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
getStandardLicenseHeaderTemplate
- Returns:
- standard license header template
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setStandardLicenseHeaderTemplate
public void setStandardLicenseHeaderTemplate(String standardLicenseHeaderTemplate) throws InvalidSPDXAnalysisException- Parameters:
standardLicenseHeaderTemplate-- Throws:
InvalidSPDXAnalysisException
-
setStandardLicenseHeader
public void setStandardLicenseHeader(String standardLicenseHeader) throws InvalidSPDXAnalysisException- Parameters:
standardLicenseHeader- the standardLicenseHeader to set- Throws:
InvalidSPDXAnalysisException
-
getStandardLicenseTemplate
- Returns:
- the template
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setStandardLicenseTemplate
- Parameters:
template- the template to set- Throws:
InvalidSPDXAnalysisException
-
toString
- Specified by:
toStringin classAnyLicenseInfo
-
_verify
Description copied from class:ModelObjectImplementation of the specific verifications for this model object- Specified by:
_verifyin classModelObject- Parameters:
verifiedIds- list of all Element Id's which have already been verified - prevents infinite recursionspecVersion- Version of the SPDX spec to verify against- Returns:
- Any verification errors or warnings associated with this object
-
isFsfLibre
- Returns:
- true if FSF describes the license as free / libre, false if FSF describes the license as not free / libre or if FSF does not reference the license
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
isNotFsfLibre
- Returns:
- true if FSF specified this license as not free/libre, false if it has been specified by the FSF as free / libre or if it has not been specified
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
getFsfLibre
- Returns:
- true if FSF describes the license as free / libre, false if FSF describes the license as not free / libre, null if FSF does not reference the license
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
isOsiApproved
- Returns:
- true if the license is listed as an approved license on the OSI website
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
isDeprecated
- Returns:
- true if this license is marked as being deprecated
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setOsiApproved
- Throws:
InvalidSPDXAnalysisException
-
setFsfLibre
- Parameters:
fsfLibre- true if FSF describes the license as free / libre, false if FSF describes the license as not free / libre, null if FSF does not reference the license- Throws:
InvalidSPDXAnalysisException
-
setDeprecated
- Parameters:
deprecated- true if this license is deprecated- Throws:
InvalidSPDXAnalysisException
-
updateSetDeprecated
public IModelStore.ModelUpdate updateSetDeprecated(Boolean deprecated) throws InvalidSPDXAnalysisException- Parameters:
deprecated-- Returns:
- a ModelUpdate that can be applied through the ModelObject
- Throws:
InvalidSPDXAnalysisException
-
equivalent
public boolean equivalent(ModelObject compare, boolean ignoreExternalReferences) throws InvalidSPDXAnalysisException- Overrides:
equivalentin classModelObjectignoreExternalReferences- if true, do not compare properties relatedSpdxElement - used to prevent infinite recursion- Returns:
- true if all the properties have the same or equivalent values
- Throws:
InvalidSPDXAnalysisException
-