All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tinystruct.data.Metadata Maven / Gradle / Ivy

Go to download

A simple framework for Java development. Simple is hard, Complex is easy. Better thinking, better design.

There is a newer version: 1.4.4
Show newest version
package org.tinystruct.data;

import java.util.HashMap;
import java.util.Map;

/**
 * Represents metadata associated with a document.
 */
public class Metadata {
    // Map to store key-value pairs of metadata.
    private final Map metadataMap;

    /**
     * Constructs a new Metadata instance.
     */
    public Metadata() {
        this.metadataMap = new HashMap<>();
    }

    /**
     * Adds a metadata entry with the specified key and value.
     *
     * @param key   the key of the metadata entry
     * @param value the value of the metadata entry
     */
    public void addMetadata(String key, String value) {
        this.metadataMap.put(key, value);
    }

    /**
     * Retrieves the value of a specific metadata entry.
     *
     * @param key the key of the metadata entry
     * @return the value associated with the key, or null if the key is not found
     */
    public String getMetadataValue(String key) {
        return this.metadataMap.get(key);
    }

    /**
     * Returns all metadata entries as a map.
     *
     * @return a map containing all metadata entries
     */
    public Map getAllMetadata() {
        return metadataMap;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy