Package org.openstreetmap.josm.data.gpx
Class WithAttributes
- java.lang.Object
-
- org.openstreetmap.josm.data.gpx.WithAttributes
-
- All Implemented Interfaces:
GpxConstants,IWithAttributes
- Direct Known Subclasses:
GpxData,GpxExtension,GpxRoute,GpxTrack,GpxTrackSegment,WayPoint
public class WithAttributes extends java.lang.Object implements IWithAttributes, GpxConstants
Default implementation for IWithAttributes. Base class for various classes in the GPX model.- Since:
- 444
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.data.gpx.GpxConstants
GpxConstants.ColorFormat
-
-
Field Summary
Fields Modifier and Type Field Description java.util.Map<java.lang.String,java.lang.Object>attrThe "attr" hash is used to store the XML payload (not only XML attributes!)private GpxExtensionCollectionextsThe "exts" collection contains all extensions.-
Fields inherited from interface org.openstreetmap.josm.data.gpx.GpxConstants
EXTENSION_ABBREVIATIONS, FIX_VALUES, GARMIN_COLORS, GPX_CMT, GPX_DESC, GPX_NAME, GPX_PREFIX, GPX_SRC, JOSM_CREATOR_NAME, META_AUTHOR_EMAIL, META_AUTHOR_LINK, META_AUTHOR_NAME, META_BOUNDS, META_COPYRIGHT_AUTHOR, META_COPYRIGHT_LICENSE, META_COPYRIGHT_YEAR, META_DESC, META_KEYWORDS, META_LINKS, META_NAME, META_PREFIX, META_TIME, PT_AGEOFDGPSDATA, PT_COURSE, PT_DGPSID, PT_ELE, PT_FIX, PT_GEOIDHEIGHT, PT_HDOP, PT_MAGVAR, PT_PDOP, PT_SAT, PT_STD_HDEV, PT_STD_VDEV, PT_SYM, PT_TIME, PT_TYPE, PT_VDOP, RTE_TRK_KEYS, RTKLIB_AGE, RTKLIB_Q, RTKLIB_RATIO, RTKLIB_SDE, RTKLIB_SDEU, RTKLIB_SDN, RTKLIB_SDNE, RTKLIB_SDU, RTKLIB_SDUN, WPT_KEYS, XML_URI_EXTENSIONS_DRAWING, XML_URI_EXTENSIONS_GARMIN, XML_URI_EXTENSIONS_JOSM, XML_URI_XSD, XML_XSD_EXTENSIONS_DRAWING, XML_XSD_EXTENSIONS_GARMIN, XML_XSD_EXTENSIONS_JOSM
-
-
Constructor Summary
Constructors Constructor Description WithAttributes()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.Objectget(java.lang.String key)Returns the Object value to which the specified key is mapped, ornullif this map contains no mapping for the key.java.util.Map<java.lang.String,java.lang.Object>getAttributes()Returns the attributes<T> java.util.Collection<T>getCollection(java.lang.String key)Returns the Collection value to which the specified key is mapped, ornullif this map contains no Collection mapping for the key.GpxExtensionCollectiongetExtensions()Returns the extensionsjava.lang.StringgetString(java.lang.String key)Returns the String value to which the specified key is mapped, ornullif this map contains no String mapping for the key.booleanhasExtensions()Returns whether theGpxExtensionCollectioninstance has been created yet, should be overridden.inthashCode()voidput(java.lang.String key, java.lang.Object value)Put a key / value pair as a new attribute.
-
-
-
Field Detail
-
attr
public java.util.Map<java.lang.String,java.lang.Object> attr
The "attr" hash is used to store the XML payload (not only XML attributes!)
-
exts
private GpxExtensionCollection exts
The "exts" collection contains all extensions.
-
-
Constructor Detail
-
WithAttributes
public WithAttributes()
-
-
Method Detail
-
get
public java.lang.Object get(java.lang.String key)
Returns the Object value to which the specified key is mapped, ornullif this map contains no mapping for the key.- Specified by:
getin interfaceIWithAttributes- Parameters:
key- the key whose associated value is to be returned- Returns:
- the value
-
getString
public java.lang.String getString(java.lang.String key)
Returns the String value to which the specified key is mapped, ornullif this map contains no String mapping for the key.- Specified by:
getStringin interfaceIWithAttributes- Parameters:
key- the key whose associated value is to be returned- Returns:
- the String value to which the specified key is mapped,
or
nullif this map contains no String mapping for the key
-
getCollection
public <T> java.util.Collection<T> getCollection(java.lang.String key)
Returns the Collection value to which the specified key is mapped, ornullif this map contains no Collection mapping for the key.- Specified by:
getCollectionin interfaceIWithAttributes- Type Parameters:
T- type of items- Parameters:
key- the key whose associated value is to be returned- Returns:
- the Collection value to which the specified key is mapped,
or
nullif this map contains no Collection mapping for the key - Since:
- 5502
-
put
public void put(java.lang.String key, java.lang.Object value)
Put a key / value pair as a new attribute. Overrides key / value pair with the same key (if present).- Specified by:
putin interfaceIWithAttributes- Parameters:
key- the keyvalue- the value
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Description copied from interface:IWithAttributesReturns the attributes- Specified by:
getAttributesin interfaceIWithAttributes- Returns:
- the attributes
-
hasExtensions
public boolean hasExtensions()
Description copied from interface:IWithAttributesReturns whether theGpxExtensionCollectioninstance has been created yet, should be overridden. The instance will usually be created on first call ofIWithAttributes.getExtensions().- Specified by:
hasExtensionsin interfaceIWithAttributes- Returns:
- whether the
GpxExtensionCollectioninstance has been created yet
-
getExtensions
public GpxExtensionCollection getExtensions()
Description copied from interface:IWithAttributesReturns the extensions- Specified by:
getExtensionsin interfaceIWithAttributes- Returns:
- the extensions
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-