Ignore:
Timestamp:
2012-09-07T22:18:59+02:00 (7 years ago)
Author:
Don-vip
Message:

fix some compilation warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java

    r1169 r5502  
    22package org.openstreetmap.josm.data.gpx;
    33
     4import java.util.Collection;
    45import java.util.HashMap;
    56import java.util.Map;
     
    78/**
    89 * Base class for various classes in the GPX model.
    9  * The "attr" hash is used to store the XML payload
    10  * (not only XML attributes!)
    1110 *
    1211 * @author Frederik Ramm <frederik@remote.org>
    13  *
     12 * @since 444
    1413 */
    1514public class WithAttributes {
    1615
     16    /**
     17     * The "attr" hash is used to store the XML payload (not only XML attributes!)
     18     */
    1719    public Map<String, Object> attr = new HashMap<String, Object>(0);
    1820
     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     */
    1929    public String getString(String key) {
    2030        Object value = attr.get(key);
    2131        return (value instanceof String) ? (String)value : null;
    2232    }
     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    }
    2347}
Note: See TracChangeset for help on using the changeset viewer.