public final class CheckParameterUtil extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
CheckParameterUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
ensureParameterNotNull(java.lang.Object value)
Ensures a parameter is not
null . |
static void |
ensureParameterNotNull(java.lang.Object value,
java.lang.String parameterName)
Ensures a parameter is not
null |
static void |
ensureThat(boolean condition,
java.lang.String message)
Ensures that the condition
condition holds. |
static void |
ensureValidCoordinates(EastNorth eastnorth,
java.lang.String parameterName)
Ensures east/north coordinates are valid
|
static void |
ensureValidCoordinates(LatLon latlon,
java.lang.String parameterName)
Ensures lat/lon coordinates are valid
|
static void |
ensureValidNodeId(PrimitiveId id,
java.lang.String parameterName)
Ensures that
id is non-null primitive id of type OsmPrimitiveType.NODE |
static void |
ensureValidPrimitiveId(PrimitiveId id,
java.lang.String parameterName)
Ensures an OSM primitive ID is valid
|
static void |
ensureValidVersion(long version,
java.lang.String parameterName)
Ensures a version number is valid
|
private CheckParameterUtil()
public static void ensureValidPrimitiveId(PrimitiveId id, java.lang.String parameterName)
id
- The id to checkparameterName
- The parameter namejava.lang.IllegalArgumentException
- if the primitive ID is not valid (negative or zero)public static void ensureValidCoordinates(LatLon latlon, java.lang.String parameterName)
latlon
- The lat/lon to checkparameterName
- The parameter namejava.lang.IllegalArgumentException
- if the lat/lon are null
or not validpublic static void ensureValidCoordinates(EastNorth eastnorth, java.lang.String parameterName)
eastnorth
- The east/north to checkparameterName
- The parameter namejava.lang.IllegalArgumentException
- if the east/north are null
or not validpublic static void ensureValidVersion(long version, java.lang.String parameterName)
version
- The version to checkparameterName
- The parameter namejava.lang.IllegalArgumentException
- if the version is not valid (negative)public static void ensureParameterNotNull(java.lang.Object value, java.lang.String parameterName)
null
value
- The parameter to checkparameterName
- The parameter namejava.lang.IllegalArgumentException
- if the parameter is null
public static void ensureParameterNotNull(java.lang.Object value)
null
. Can find line number in the stack trace, so parameter name is optionalvalue
- The parameter to checkjava.lang.IllegalArgumentException
- if the parameter is null
public static void ensureThat(boolean condition, java.lang.String message)
condition
holds.condition
- The condition to checkjava.lang.IllegalArgumentException
- if the condition does not holdpublic static void ensureValidNodeId(PrimitiveId id, java.lang.String parameterName)
id
is non-null primitive id of type OsmPrimitiveType.NODE
id
- the primitive idparameterName
- the name of the parameter to be checkedjava.lang.IllegalArgumentException
- if id is nulljava.lang.IllegalArgumentException
- if id.getType() != NODE