Changeset 5502 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2012-09-07T22:18:59+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java
r1169 r5502 2 2 package org.openstreetmap.josm.data.gpx; 3 3 4 import java.util.Collection; 4 5 import java.util.HashMap; 5 6 import java.util.Map; … … 7 8 /** 8 9 * Base class for various classes in the GPX model. 9 * The "attr" hash is used to store the XML payload10 * (not only XML attributes!)11 10 * 12 11 * @author Frederik Ramm <frederik@remote.org> 13 * 12 * @since 444 14 13 */ 15 14 public class WithAttributes { 16 15 16 /** 17 * The "attr" hash is used to store the XML payload (not only XML attributes!) 18 */ 17 19 public Map<String, Object> attr = new HashMap<String, Object>(0); 18 20 21 /** 22 * Returns the String value to which the specified key is mapped, 23 * or {@code null} if this map contains no String mapping for the key. 24 * 25 * @param key the key whose associated value is to be returned 26 * @return the String value to which the specified key is mapped, 27 * or {@code null} if this map contains no String mapping for the key 28 */ 19 29 public String getString(String key) { 20 30 Object value = attr.get(key); 21 31 return (value instanceof String) ? (String)value : null; 22 32 } 33 34 /** 35 * Returns the Collection value to which the specified key is mapped, 36 * or {@code null} if this map contains no Collection mapping for the key. 37 * 38 * @param key the key whose associated value is to be returned 39 * @return the Collection value to which the specified key is mapped, 40 * or {@code null} if this map contains no Collection mapping for the key 41 * @since 5502 42 */ 43 public Collection<?> getCollection(String key) { 44 Object value = attr.get(key); 45 return (value instanceof Collection<?>) ? (Collection<?>)value : null; 46 } 23 47 }
Note:
See TracChangeset
for help on using the changeset viewer.