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 Details

  • Constructor Details

    • BaseModuleMetadata

      protected BaseModuleMetadata(M manifest, ModuleType moduleType, boolean xapiEnabled)
      Constructor for BaseModuleMetadata.
      Parameters:
      manifest - The package manifest.
      moduleType - The module type.
      xapiEnabled - Whether xAPI is enabled.
  • Method Details

    • addMetadataComponent

      public void addMetadataComponent(@NonNull @NonNull MetadataComponent component)
      Adds a metadata component to this module's composite metadata.
      Parameters:
      component - The component to add.
    • getMetadata

      public Optional<Object> getMetadata(String key)
      Description copied from interface: MetadataComponent
      Gets a metadata value by key.
      Specified by:
      getMetadata in interface MetadataComponent
      Parameters:
      key - The key to look up.
      Returns:
      An Optional containing the value if found, or empty if not found.
    • getMetadata

      public <T> Optional<T> getMetadata(String key, Class<T> type)
      Description copied from interface: MetadataComponent
      Gets a metadata value by key, with type conversion.
      Specified by:
      getMetadata in interface MetadataComponent
      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

      public boolean hasMetadata(String key)
      Description copied from interface: MetadataComponent
      Checks if this component contains metadata for the given key.
      Specified by:
      hasMetadata in interface MetadataComponent
      Parameters:
      key - The key to check.
      Returns:
      true if this component contains metadata for the key, false otherwise.
    • getSimpleMetadata

      protected SimpleMetadata getSimpleMetadata(PackageManifest manifest)
      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.