org.apache.commons.attributes
Class ParameterIndexOutOfBoundsException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended byjava.lang.IndexOutOfBoundsException
                  extended byorg.apache.commons.attributes.ParameterIndexOutOfBoundsException
All Implemented Interfaces:
Serializable

public class ParameterIndexOutOfBoundsException
extends IndexOutOfBoundsException

Thrown when attempting to get attributes for a parameter of a constructor or method and the parameter index is out of bounds.

Note: for performance reasons, this exception is only thrown when the Commons Attribute runtime can quickly determine that the index is out of bounds. Therefore, you may sometimes be able to pass an invalid index and not receive this exception. For example, if the runtime knows that the method or constructor has no attributes at all, an empty collection / null or false (as appropriate) will be returned instead. Put simply, don't use this exception to test how many parameters a method or constructor has.

Since:
2.2
See Also:
Serialized Form

Constructor Summary
ParameterIndexOutOfBoundsException(String methodOrConstructorName, int index, int maxIndex)
          Create a new ParameterIndexOutOfBoundsException.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParameterIndexOutOfBoundsException

public ParameterIndexOutOfBoundsException(String methodOrConstructorName,
                                          int index,
                                          int maxIndex)
Create a new ParameterIndexOutOfBoundsException.

Parameters:
methodOrConstructorName - the name of the method or constructor whose parameter the client tried to get attributes for.
index - the index supplied by the client.
maxIndex - the maximum + 1 parameter index allowed. For example, if a method takes two parameters, the maximum allowed index is 1, and this parameter should be set to 2. There is no minIndex parameter - it is assumed to be 0.


Copyright © The Apache Software Foundation. All Rights Reserved.