org.apache.commons.lang

Class NotImplementedException

Implemented Interfaces:
Nestable, Serializable

public class NotImplementedException
extends UnsupportedOperationException
implements Nestable

Thrown to indicate that a block of code has not been implemented. This exception supplements UnsupportedOperationException by providing a more semantically rich description of the problem.

NotImplementedException represents the case where the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. Because this logic might be within a catch block, this exception suports exception chaining.

 public void foo() {
   try {
     // do something that throws an Exception
   } catch (Exception ex) {
     // don't know what to do here yet
     throw new NotImplementedException("TODO", ex);
   }
 }
 
Since:
2.0
See Also:
Serialized Form

Constructor Summary

NotImplementedException()
Constructs a new NotImplementedException with default message.
NotImplementedException(Class<T> clazz)
Constructs a new NotImplementedException referencing the specified class.
NotImplementedException(String msg)
Constructs a new NotImplementedException with specified detail message.
NotImplementedException(String msg, Throwable cause)
Constructs a new NotImplementedException with specified detail message and nested Throwable.
NotImplementedException(Throwable cause)
Constructs a new NotImplementedException with specified nested Throwable and default message.

Method Summary

Throwable
getCause()
Gets the root cause of this exception.
String
getMessage()
Gets the combined the error message of this and any nested errors.
String
getMessage(int index)
Returns the error message of the Throwable in the chain of Throwables at the specified index, numbered from 0.
String[]
getMessages()
Returns the error message of this and any nested Throwable objects.
Throwable
getThrowable(int index)
Returns the Throwable in the chain by index.
int
getThrowableCount()
Returns the number of nested Throwables represented by this Nestable, including this Nestable.
Throwable[]
getThrowables()
Returns this Nestable and any nested Throwables in an array of Throwables, one element for each Throwable.
int
indexOfThrowable(Class<T> type)
Returns the index of the first occurrence of the specified type.
int
indexOfThrowable(Class<T> type, int fromIndex)
Returns the index of the first occurrence of the specified type starting from the specified index.
void
printPartialStackTrace(PrintWriter out)
Prints the stack trace for this exception only (root cause not included) using the specified writer.
void
printStackTrace()
Prints the stack trace of this exception.
void
printStackTrace(PrintStream out)
Prints the stack trace of this exception to the specified stream.
void
printStackTrace(PrintWriter out)
Prints the stack trace of this exception to the specified writer.

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, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

NotImplementedException

public NotImplementedException()
Constructs a new NotImplementedException with default message.
Since:
2.1

NotImplementedException

public NotImplementedException(Class<T> clazz)
Constructs a new NotImplementedException referencing the specified class.
Parameters:
clazz - the Class that has not implemented the method
Usages and Demos :

View More Examples of NotImplementedException(Class clazz)
   1:     public ArchiveReader getDeleteFileOnCloseReader(final File f) {
   2:         throw new NotImplementedException("TODO");
   3:     }  
   4: 
   5:     @Override

View Full Code Here

NotImplementedException

public NotImplementedException(String msg)
Constructs a new NotImplementedException with specified detail message.
Parameters:
msg - the error message.
Usages and Demos :

View More Examples of NotImplementedException(String msg)
   1:     public ArchiveReader getDeleteFileOnCloseReader(final File f) {
   2:         throw new NotImplementedException("TODO");
   3:     }  
   4: 
   5:     @Override

View Full Code Here

NotImplementedException

public NotImplementedException(String msg,
                               Throwable cause)
Constructs a new NotImplementedException with specified detail message and nested Throwable.
Parameters:
msg - the error message
cause - the exception that caused this exception to be thrown
Since:
2.1

NotImplementedException

public NotImplementedException(Throwable cause)
Constructs a new NotImplementedException with specified nested Throwable and default message.
Parameters:
cause - the exception that caused this exception to be thrown
Since:
2.1
Usages and Demos :

View More Examples of NotImplementedException(Throwable cause)
   1:     public ArchiveReader getDeleteFileOnCloseReader(final File f) {
   2:         throw new NotImplementedException("TODO");
   3:     }  
   4: 
   5:     @Override

View Full Code Here

Method Details

getCause

public Throwable getCause()
Gets the root cause of this exception.
Specified by:
getCause in interface Nestable
Overrides:
getCause in interface Throwable
Returns:
the root cause of this exception.
Since:
2.1

getMessage

public String getMessage()
Gets the combined the error message of this and any nested errors.
Specified by:
getMessage in interface Nestable
Overrides:
getMessage in interface Throwable
Returns:
the error message
Since:
2.1

getMessage

public String getMessage(int index)
Returns the error message of the Throwable in the chain of Throwables at the specified index, numbered from 0.
Specified by:
getMessage in interface Nestable
Parameters:
index - the index of the Throwable in the chain
Returns:
the error message, or null if the Throwable at the specified index in the chain does not contain a message
Throws:
IndexOutOfBoundsException - if the index argument is negative or not less than the count of Throwables in the chain
Since:
2.1

getMessages

public String[] getMessages()
Returns the error message of this and any nested Throwable objects. Each throwable returns a message, a null string is included in the array if there is no message for a particular Throwable.
Specified by:
getMessages in interface Nestable
Returns:
the error messages
Since:
2.1

getThrowable

public Throwable getThrowable(int index)
Returns the Throwable in the chain by index.
Specified by:
getThrowable in interface Nestable
Parameters:
index - the index to retrieve
Returns:
the Throwable
Throws:
IndexOutOfBoundsException - if the index argument is negative or not less than the count of Throwables in the chain
Since:
2.1

getThrowableCount

public int getThrowableCount()
Returns the number of nested Throwables represented by this Nestable, including this Nestable.
Specified by:
getThrowableCount in interface Nestable
Returns:
the throwable count
Since:
2.1

getThrowables

public Throwable[] getThrowables()
Returns this Nestable and any nested Throwables in an array of Throwables, one element for each Throwable.
Specified by:
getThrowables in interface Nestable
Returns:
the Throwables
Since:
2.1

indexOfThrowable

public int indexOfThrowable(Class<T> type)
Returns the index of the first occurrence of the specified type. If there is no match, -1 is returned.
Specified by:
indexOfThrowable in interface Nestable
Parameters:
type - the type to search for
Returns:
index of the first occurrence of the type in the chain, or -1 if the type is not found
Since:
2.1

indexOfThrowable

public int indexOfThrowable(Class<T> type,
                            int fromIndex)
Returns the index of the first occurrence of the specified type starting from the specified index. If there is no match, -1 is returned.
Specified by:
indexOfThrowable in interface Nestable
Parameters:
type - the type to search for
fromIndex - the index of the starting position in the chain to be searched
Returns:
index of the first occurrence of the type in the chain, or -1 if the type is not found
Throws:
IndexOutOfBoundsException - if the fromIndex argument is negative or not less than the count of Throwables in the chain
Since:
2.1

printPartialStackTrace

public final void printPartialStackTrace(PrintWriter out)
Prints the stack trace for this exception only (root cause not included) using the specified writer.
Specified by:
printPartialStackTrace in interface Nestable
Parameters:
out - the writer to write to
Since:
2.1

printStackTrace

public void printStackTrace()
Prints the stack trace of this exception. Includes information from the exception, if any, which caused this exception.
Overrides:
printStackTrace in interface Throwable
Since:
2.1

printStackTrace

public void printStackTrace(PrintStream out)
Prints the stack trace of this exception to the specified stream. Includes information from the exception, if any, which caused this exception.
Specified by:
printStackTrace in interface Nestable
Overrides:
printStackTrace in interface Throwable
Parameters:
out - the stream to write to
Since:
2.1

printStackTrace

public void printStackTrace(PrintWriter out)
Prints the stack trace of this exception to the specified writer. Includes information from the exception, if any, which caused this exception.
Specified by:
printStackTrace in interface Nestable
Overrides:
printStackTrace in interface Throwable
Parameters:
out - the writer to write to
Since:
2.1