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 * @param <T> type of items 034 * 035 * @param key the key whose associated value is to be returned 036 * @return the Collection value to which the specified key is mapped, 037 * or {@code null} if this map contains no Collection mapping for the key 038 * @since 5502 039 */ 040 <T> Collection<T> getCollection(String key); 041 042 /** 043 * Put a key / value pair as a new attribute. 044 * 045 * Overrides key / value pair with the same key (if present). 046 * 047 * @param key the key 048 * @param value the value 049 */ 050 void put(String key, Object value); 051 052 /** 053 * Add a key / value pair that is not part of the GPX schema as an extension. 054 * 055 * @param key the key 056 * @param value the value 057 */ 058 void addExtension(String key, String value); 059 060}