Package org.spdx.library.model.v2
Class SpdxModelFactoryCompatV2
- java.lang.Object
-
- org.spdx.library.model.v2.SpdxModelFactoryCompatV2
-
public class SpdxModelFactoryCompatV2 extends Object
Factory class to create ModelObjects based on the type and SPDX Spec Version Types are defined classes in the SpdxConstantsCompatV2 class and map to the standard SPDX model- Author:
- Gary O'Neall
-
-
Field Summary
Fields Modifier and Type Field Description static Map<Class<?>,String>
SPDX_CLASS_TO_TYPE
static Map<String,Class<?>>
SPDX_TYPE_TO_CLASS_V2
-
Constructor Summary
Constructors Constructor Description SpdxModelFactoryCompatV2()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Class<?>
classUriToClass(String classUri)
static ModelObjectV2
createModelObjectV2(org.spdx.storage.IModelStore modelStore, String documentUri, String id, String type, org.spdx.core.IModelCopyManager copyManager)
Create an SPDX version 2 model object in a model store given the document URI, ID and typestatic SpdxDocument
createSpdxDocumentV2(org.spdx.storage.IModelStore modelStore, String documentUri, org.spdx.core.IModelCopyManager copyManager)
Create an SPDX version 2.X document with default values for creator, created, licenseListVersion, data license and specVersionstatic ModelObjectV2
getModelObjectV2(org.spdx.storage.IModelStore modelStore, String documentUri, String id, String type, org.spdx.core.IModelCopyManager copyManager, boolean create)
Create an SPDX spec version 2.X model object in a model store given the document URI, ID and typestatic Optional<ModelObjectV2>
getModelObjectV2(org.spdx.storage.IModelStore modelStore, String documentUri, String id, org.spdx.core.IModelCopyManager copyManager)
static Class<? extends Object>
typeToClass(String type)
-
-
-
Method Detail
-
createSpdxDocumentV2
public static SpdxDocument createSpdxDocumentV2(org.spdx.storage.IModelStore modelStore, String documentUri, org.spdx.core.IModelCopyManager copyManager) throws org.spdx.core.InvalidSPDXAnalysisException
Create an SPDX version 2.X document with default values for creator, created, licenseListVersion, data license and specVersion- Parameters:
modelStore
- Where to store the SPDX DocumentdocumentUri
- unique URI for the SPDX documentcopyManager
- if non-null, allows for copying of properties from other model stores or document URI's when referenced- Returns:
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
createModelObjectV2
public static ModelObjectV2 createModelObjectV2(org.spdx.storage.IModelStore modelStore, String documentUri, String id, String type, org.spdx.core.IModelCopyManager copyManager) throws org.spdx.core.InvalidSPDXAnalysisException
Create an SPDX version 2 model object in a model store given the document URI, ID and type- Parameters:
modelStore
- model store where the object is to be createddocumentUri
- document URI for the stored itemid
- for the itemtype
- SPDX class or typecopyManager
- if non-null, allows for copying of properties from other model stores or document URI's when referenced- Returns:
- a ModelObjectV2 of type type
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getModelObjectV2
public static ModelObjectV2 getModelObjectV2(org.spdx.storage.IModelStore modelStore, String documentUri, String id, String type, org.spdx.core.IModelCopyManager copyManager, boolean create) throws org.spdx.core.InvalidSPDXAnalysisException
Create an SPDX spec version 2.X model object in a model store given the document URI, ID and type- Parameters:
modelStore
- model store where the object is to be createddocumentUri
- document URI for the stored itemid
- ID for the itemtype
- SPDX class or typecopyManager
- if non-null, allows for copying of properties from other model stores or document URI's when referencedcreate
- if true, create the model object if it does not already exist- Returns:
- a ModelObjectV2 of type type
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getModelObjectV2
public static Optional<ModelObjectV2> getModelObjectV2(org.spdx.storage.IModelStore modelStore, String documentUri, String id, @Nullable org.spdx.core.IModelCopyManager copyManager) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
modelStore
- Store for the SPDX Spec version 2 modeldocumentUri
- Document URI for for the IDcopyManager
- Optional copy manager for copying any properties from other modelid
- ID for the model object- Returns:
- SPDX Version 2 compatible ModelObjectV2 with the ID in the model store
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
typeToClass
public static Class<? extends Object> typeToClass(String type) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
type
- SPDX Type- Returns:
- class associated with the type
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
-