Interface MetadataComponent
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AiccMetadata,BaseModuleMetadata,Cmi5Metadata,CompositeMetadata,Scorm12Metadata,Scorm2004Metadata,SimpleMetadata
Interface for all metadata components in the composite pattern. This interface defines the common
methods that all metadata components must implement.
The composite pattern allows for creating a tree structure of metadata components, where each component can be either a leaf (simple metadata) or a composite (containing other components).
-
Method Summary
Modifier and TypeMethodDescriptiongetMetadata(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.booleanhasMetadata(String key) Checks if this component contains metadata for the given key.
-
Method Details
-
getMetadata
Gets a metadata value by key.- Parameters:
key- The key to look up.- Returns:
- An Optional containing the value if found, or empty if not found.
-
getMetadata
Gets a metadata value by key, with type conversion.- 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
Checks if this component contains metadata for the given key.- Parameters:
key- The key to check.- Returns:
- true if this component contains metadata for the key, false otherwise.
-