|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
ObjectEnum<Geometries>
Geometries
public enum Geometries
Constants to identify JTS geometry types, reducing the need for boiler-plate code such as this...
if (Polygon.class.isAssignableFrom(myObject.getClass()) ||
MultiPolygon.class.isAssignableFrom(myObject.getClass())) {
// do polygon thing
...
} else if (LineString.class.isAssignableFrom(myObject.getClass()) ||
MultiLineString.class.isAssignableFrom(myObject.getClass())) {
// do line thing
....
} else {
// do point thing
....
}
Instead you can do this...
Geometries geomType = Geometries.get(myObject);
switch (geomType) {
case POLYGON:
case MULTIPOLYGON:
// do polygon thing
break;
case LINESTRING:
case MULTILINESTRING:
// do line thing
break;
case POINT:
case MULTIPOINT:
// do point thing
break;
default:
// e.g. unspecified Geometry, GeometryCollection
break;
}
You can also work with Class
objects...
Class extends Geometry> aClass = ...
Geometries type = Geometries.getForBinding( aClass );
Enum Constant Summary | |
---|---|
GEOMETRY
|
|
GEOMETRYCOLLECTION
|
|
LINESTRING
|
|
MULTILINESTRING
|
|
MULTIPOINT
|
|
MULTIPOLYGON
|
|
POINT
|
|
POLYGON
|
Method Summary | |
---|---|
static Geometries |
get(Geometry geom)
Get the Geometries for the given object. |
Class<? extends Geometry> |
getBinding()
Return the Geometry class associated with this type. |
static Geometries |
getForBinding(Class<? extends Geometry> geomClass)
Get the Geometries for the given Geometry class. |
static Geometries |
getForName(String name)
Get the Geometries for the specified name. |
static Geometries |
getForSQLType(int sqlType)
Get the Geometries with the given integer SQL type code. |
String |
getName()
Return a name for this type that is suitable for text descriptions. |
String |
getSimpleName()
Get the 'simple name'. |
Integer |
getSQLType()
Return the integer SQL type code for this geometry type. |
String |
toString()
Equivalent to getName(). |
static Geometries |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static Geometries[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf |
Methods inherited from class Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final Geometries POINT
public static final Geometries LINESTRING
public static final Geometries POLYGON
public static final Geometries MULTIPOINT
public static final Geometries MULTILINESTRING
public static final Geometries MULTIPOLYGON
public static final Geometries GEOMETRY
public static final Geometries GEOMETRYCOLLECTION
Method Detail |
---|
public static Geometries[] values()
for (Geometries c : Geometries.values()) System.out.println(c);
public static Geometries valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic Class<? extends Geometry> getBinding()
Geometry
class associated with this type.
Geometry
classpublic Integer getSQLType()
public String toString()
toString
in class Enum<Geometries>
public String getName()
public String getSimpleName()
public static Geometries get(Geometry geom)
Geometries
for the given object.
geom
- a JTS Geometry object
Geometries
for the argument's class, or null
if the argument is null
public static Geometries getForBinding(Class<? extends Geometry> geomClass)
Geometries
for the given Geometry
class.
geomClass
- the class
public static Geometries getForName(String name)
Geometries
for the specified name.
name
- The name of the geometry, eg: "POINT"
public static Geometries getForSQLType(int sqlType)
Geometries
with the given integer SQL type code.
sqlType
- the code to look up.
null
if no match was found
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |