Class InvalidGeometryArgument

  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by java.lang.IllegalArgumentException
                  extended by net.surveyos.sourceforge.jtswarped.utilities.exceptions.InvalidGeometryArgument
All Implemented Interfaces:

public class InvalidGeometryArgument
extends java.lang.IllegalArgumentException

An exception thrown when a method receives as an argument a Geometry object that is not appropriate for the operation performed by the method. For example, a method may work on LineStrings and Polygons, but not on Points. Why use this Exception, and not the standard IllegalArgumentException? First of all, this identifies the geometry argument, and not any other arguments passed to the method throwing the exception as the problem. Secondly, this exception identifies the subclass of Geometry that caused the exception, and also identifies the correct subclasses of Geometry that can be passed to the method without throwing this exception.

See Also:
Serialized Form

Constructor Summary
InvalidGeometryArgument(java.lang.String argInvalidSubclassName, java.lang.String[] argSupportedSubclassNames)
          Creates a new instance of InvalidGeometryArgument.
Method Summary
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public InvalidGeometryArgument(java.lang.String argInvalidSubclassName,
                               java.lang.String[] argSupportedSubclassNames)

Creates a new instance of InvalidGeometryArgument. This constructor accepts the String of the invalid class name as an argument and an array containing the class names of Geometry subclasses supported by the method throwing the exception.

For example, if a method operates on LineString geometries and Polygon geometries, but not Point geometries, the exception would be contructed in this way:

String[] supportedClasses = new String[2];
supportedClasses[0] = LineString;
supportedClasses[1] = Polygon;

* InvalidGeometryArgument wrongGeometry = new InvalidGeometryArgument("Point", supportedClasses);