Package org.openstreetmap.josm.data.osm
Enum OsmPrimitiveType
- java.lang.Object
-
- java.lang.Enum<OsmPrimitiveType>
-
- org.openstreetmap.josm.data.osm.OsmPrimitiveType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<OsmPrimitiveType>
public enum OsmPrimitiveType extends java.lang.Enum<OsmPrimitiveType>
OSM primitive type.- Since:
- 1670
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CLOSEDWAYClosed way: only for display, no real typeMULTIPOLYGONMultipolygon: only for display, no real typeNODENode typeRELATIONRelation typeWAYWay type
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringapiTypeNameprivate static java.util.Collection<OsmPrimitiveType>DATA_VALUESprivate java.lang.Class<? extends PrimitiveData>dataClassprivate UniqueIdGeneratoridGeneratorprivate java.lang.Class<? extends OsmPrimitive>osmClass
-
Constructor Summary
Constructors Modifier Constructor Description privateOsmPrimitiveType(java.lang.String apiTypeName, java.lang.Class<? extends OsmPrimitive> osmClass, java.lang.Class<? extends PrimitiveData> dataClass, UniqueIdGenerator idGenerator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Collection<OsmPrimitiveType>dataValues()Returns the values matching real OSM API data types (node, way, relation).static OsmPrimitiveTypefrom(java.lang.String value)Returns enum value from API type name / JOSM display name, case insensitive.static OsmPrimitiveTypefrom(IPrimitive obj)Determines the OSM primitive type of the given object.static OsmPrimitiveTypefromApiTypeName(java.lang.String typeName)Returns enum value from API type name / JOSM display name, case sensitive.java.lang.StringgetAPIName()Returns the API type name / JOSM display name.java.lang.Class<? extends PrimitiveData>getDataClass()Returns the data class.UniqueIdGeneratorgetIdGenerator()Returns the unique identifier generator.java.lang.Class<? extends OsmPrimitive>getOsmClass()Returns the OSM class for data values, or null.OsmPrimitivenewInstance(long uniqueId, boolean allowNegative)Constructs a new primitive instance (node, way or relation) without version.OsmPrimitivenewVersionedInstance(long id, int version)Constructs a new primitive instance (node, way or relation) with given version.java.lang.StringtoString()static OsmPrimitiveTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static OsmPrimitiveType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NODE
public static final OsmPrimitiveType NODE
Node type
-
WAY
public static final OsmPrimitiveType WAY
Way type
-
RELATION
public static final OsmPrimitiveType RELATION
Relation type
-
CLOSEDWAY
public static final OsmPrimitiveType CLOSEDWAY
Closed way: only for display, no real type
-
MULTIPOLYGON
public static final OsmPrimitiveType MULTIPOLYGON
Multipolygon: only for display, no real type
-
-
Field Detail
-
DATA_VALUES
private static final java.util.Collection<OsmPrimitiveType> DATA_VALUES
-
apiTypeName
private final java.lang.String apiTypeName
-
osmClass
private final java.lang.Class<? extends OsmPrimitive> osmClass
-
dataClass
private final java.lang.Class<? extends PrimitiveData> dataClass
-
idGenerator
private final UniqueIdGenerator idGenerator
-
-
Constructor Detail
-
OsmPrimitiveType
private OsmPrimitiveType(java.lang.String apiTypeName, java.lang.Class<? extends OsmPrimitive> osmClass, java.lang.Class<? extends PrimitiveData> dataClass, UniqueIdGenerator idGenerator)
-
-
Method Detail
-
values
public static OsmPrimitiveType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (OsmPrimitiveType c : OsmPrimitiveType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static OsmPrimitiveType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getAPIName
public java.lang.String getAPIName()
Returns the API type name / JOSM display name.- Returns:
- the API type name / JOSM display name
-
getOsmClass
public java.lang.Class<? extends OsmPrimitive> getOsmClass()
Returns the OSM class for data values, or null.- Returns:
- the OSM class for data values, or null
-
getDataClass
public java.lang.Class<? extends PrimitiveData> getDataClass()
Returns the data class.- Returns:
- the data class
-
fromApiTypeName
public static OsmPrimitiveType fromApiTypeName(java.lang.String typeName)
Returns enum value from API type name / JOSM display name, case sensitive.- Parameters:
typeName- API type name / JOSM display name, case sensitive- Returns:
- matching enum value
- Throws:
java.lang.IllegalArgumentException- if the type name does not match any valid type- See Also:
from(String)
-
from
public static OsmPrimitiveType from(IPrimitive obj)
Determines the OSM primitive type of the given object.- Parameters:
obj- the OSM object to inspect- Returns:
- the OSM primitive type of
obj - Throws:
java.lang.IllegalArgumentException- ifobjis null or of unknown type
-
from
public static OsmPrimitiveType from(java.lang.String value)
Returns enum value from API type name / JOSM display name, case insensitive.- Parameters:
value- API type name / JOSM display name, case insensitive- Returns:
- matching enum value or null
- See Also:
fromApiTypeName(java.lang.String)
-
dataValues
public static java.util.Collection<OsmPrimitiveType> dataValues()
Returns the values matching real OSM API data types (node, way, relation).- Returns:
- the values matching real OSM API data types (node, way, relation)
-
newInstance
public OsmPrimitive newInstance(long uniqueId, boolean allowNegative)
Constructs a new primitive instance (node, way or relation) without version.- Parameters:
uniqueId- the unique idallowNegative-trueto allow negative id- Returns:
- a new primitive instance (node, way or relation)
- Throws:
java.lang.IllegalArgumentException- if uniqueId < 0 and allowNegative is false
-
newVersionedInstance
public OsmPrimitive newVersionedInstance(long id, int version)
Constructs a new primitive instance (node, way or relation) with given version.- Parameters:
id- The id. Must be >= 0version- The version- Returns:
- a new primitive instance (node, way or relation) with given version
- Throws:
java.lang.IllegalArgumentException- if id < 0- Since:
- 12018
-
getIdGenerator
public UniqueIdGenerator getIdGenerator()
Returns the unique identifier generator.- Returns:
- the unique identifier generator
- Since:
- 15820
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Enum<OsmPrimitiveType>
-
-