001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.gpx;
003
004import java.util.Collection;
005
006/**
007 * Object with attributes (in the context of GPX data).
008 */
009public interface IWithAttributes {
010
011    /**
012     * Returns the Object value to which the specified key is mapped,
013     * or {@code null} if this map contains no mapping for the key.
014     *
015     * @param key the key whose associated value is to be returned
016     * @return the value
017     */
018    Object get(String key);
019
020    /**
021     * Returns the String value to which the specified key is mapped,
022     * or {@code null} if this map contains no String mapping for the key.
023     *
024     * @param key the key whose associated value is to be returned
025     * @return the String value to which the specified key is mapped,
026     *         or {@code null} if this map contains no String mapping for the key
027     */
028    String getString(String key);
029
030    /**
031     * Returns the Collection value to which the specified key is mapped,
032     * or {@code null} if this map contains no Collection mapping for the key.
033     *
034     * @param key the key whose associated value is to be returned
035     * @return the Collection value to which the specified key is mapped,
036     *         or {@code null} if this map contains no Collection mapping for the key
037     * @since 5502
038     */
039    <T> Collection<T> getCollection(String key);
040
041    /**
042     * Put a key / value pair as a new attribute.
043     *
044     * Overrides key / value pair with the same key (if present).
045     *
046     * @param key the key
047     * @param value the value
048     */
049    void put(String key, Object value);
050
051    /**
052     * Add a key / value pair that is not part of the GPX schema as an extension.
053     *
054     * @param key the key
055     * @param value the value
056     */
057    void addExtension(String key, String value);
058
059}