001 // License: GPL. 002 package org.openstreetmap.josm.data.gpx; 003 004 import java.util.HashMap; 005 import java.util.Map; 006 007 /** 008 * Base class for various classes in the GPX model. 009 * The "attr" hash is used to store the XML payload 010 * (not only XML attributes!) 011 * 012 * @author Frederik Ramm <frederik@remote.org> 013 * 014 */ 015 public class WithAttributes { 016 017 public Map<String, Object> attr = new HashMap<String, Object>(0); 018 019 public String getString(String key) { 020 Object value = attr.get(key); 021 return (value instanceof String) ? (String)value : null; 022 } 023 }