org.apache.commons.attributes
Class ParameterIndexOutOfBoundsException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by java.lang.IndexOutOfBoundsException
                  extended by org.apache.commons.attributes.ParameterIndexOutOfBoundsException
All Implemented Interfaces:
java.io.Serializable

public class ParameterIndexOutOfBoundsException
extends java.lang.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(java.lang.String methodOrConstructorName, int index, int maxIndex)
          Create a new ParameterIndexOutOfBoundsException.
 
Method Summary
private static java.lang.String formatMessage(java.lang.String methodOrConstructorName, int index, int maxIndex)
           
 
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(java.lang.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.
Method Detail

formatMessage

private static java.lang.String formatMessage(java.lang.String methodOrConstructorName,
                                              int index,
                                              int maxIndex)