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