Class BaseModuleMetadata<M extends PackageManifest>
java.lang.Object
dev.jcputney.elearning.parser.output.ModuleMetadata<M>
dev.jcputney.elearning.parser.output.metadata.BaseModuleMetadata<M>
- Type Parameters:
M- The type of package manifest.
- All Implemented Interfaces:
PackageManifest,MetadataComponent,Serializable
- Direct Known Subclasses:
AiccMetadata,Cmi5Metadata,Scorm12Metadata,Scorm2004Metadata
public abstract class BaseModuleMetadata<M extends PackageManifest>
extends ModuleMetadata<M>
implements MetadataComponent
Base class for module metadata that implements the MetadataComponent interface.
This class serves as a bridge between the old metadata model and the new composite metadata model. It provides the core capability of the old ModuleMetadata class while implementing the new MetadataComponent interface.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CompositeMetadataThe composite metadata component that contains additional metadata.static final StringThe description field of the module metadata.static final StringThe duration field of the module metadata.static final StringThe identifier field of the module metadata.static final StringThe launch URL field of the module metadata.static final StringThe module type field of the module metadata.static final StringThe title field of the module metadata.static final StringThe version field of the module metadata.static final StringThe xAPI enabled field of the module metadata.Fields inherited from class dev.jcputney.elearning.parser.output.ModuleMetadata
manifest, moduleEditionType, moduleType, xapiEnabled -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseModuleMetadata(M manifest, ModuleType moduleType, boolean xapiEnabled) Constructor for BaseModuleMetadata. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetadataComponent(@NonNull MetadataComponent component) Adds a metadata component to this module's composite metadata.getMetadata(String key) Gets a metadata value by key.<T> Optional<T>getMetadata(String key, Class<T> type) Gets a metadata value by key, with type conversion.protected SimpleMetadatagetSimpleMetadata(PackageManifest manifest) Creates a SimpleMetadata object from the provided PackageManifest.booleanhasMetadata(String key) Checks if this component contains metadata for the given key.Methods inherited from class dev.jcputney.elearning.parser.output.ModuleMetadata
equals, getDescription, getDuration, getIdentifier, getLaunchUrl, getTitle, getVersion, hashCode
-
Field Details
-
TITLE
The title field of the module metadata.- See Also:
-
DESCRIPTION
The description field of the module metadata.- See Also:
-
LAUNCH_URL
The launch URL field of the module metadata.- See Also:
-
IDENTIFIER
The identifier field of the module metadata.- See Also:
-
VERSION
The version field of the module metadata.- See Also:
-
DURATION
The duration field of the module metadata.- See Also:
-
MODULE_TYPE
The module type field of the module metadata.- See Also:
-
XAPI_ENABLED
The xAPI enabled field of the module metadata.- See Also:
-
compositeMetadata
The composite metadata component that contains additional metadata.
-
-
Constructor Details
-
BaseModuleMetadata
Constructor for BaseModuleMetadata.- Parameters:
manifest- The package manifest.moduleType- The module type.xapiEnabled- Whether xAPI is enabled.
-
-
Method Details
-
addMetadataComponent
Adds a metadata component to this module's composite metadata.- Parameters:
component- The component to add.
-
getMetadata
Description copied from interface:MetadataComponentGets a metadata value by key.- Specified by:
getMetadatain interfaceMetadataComponent- Parameters:
key- The key to look up.- Returns:
- An Optional containing the value if found, or empty if not found.
-
getMetadata
Description copied from interface:MetadataComponentGets a metadata value by key, with type conversion.- Specified by:
getMetadatain interfaceMetadataComponent- Type Parameters:
T- The type to convert the value to.- Parameters:
key- The key to look up.type- The class to convert the value to.- Returns:
- An Optional containing the converted value if found, or empty if not found.
-
hasMetadata
Description copied from interface:MetadataComponentChecks if this component contains metadata for the given key.- Specified by:
hasMetadatain interfaceMetadataComponent- Parameters:
key- The key to check.- Returns:
- true if this component contains metadata for the key, false otherwise.
-
getSimpleMetadata
Creates a SimpleMetadata object from the provided PackageManifest.- Parameters:
manifest- The package manifest to extract metadata from.- Returns:
- A SimpleMetadata object containing the extracted metadata.
-