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