public class NotImplementedException extends java.lang.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); } }
Constructor and Description |
---|
NotImplementedException()
Constructs a new
NotImplementedException with default message. |
NotImplementedException(java.lang.Class clazz)
Constructs a new
NotImplementedException referencing the specified class. |
NotImplementedException(java.lang.String msg)
Constructs a new
NotImplementedException with specified
detail message. |
NotImplementedException(java.lang.String msg,
java.lang.Throwable cause)
Constructs a new
NotImplementedException with specified
detail message and nested Throwable . |
NotImplementedException(java.lang.Throwable cause)
Constructs a new
NotImplementedException with specified
nested Throwable and default message. |
Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
getCause()
Gets the root cause of this exception.
|
java.lang.String |
getMessage()
Gets the combined the error message of this and any nested errors.
|
java.lang.String |
getMessage(int index)
Returns the error message of the
Throwable in the chain
of Throwable s at the specified index, numbered from 0. |
java.lang.String[] |
getMessages()
Returns the error message of this and any nested
Throwable objects. |
java.lang.Throwable |
getThrowable(int index)
Returns the
Throwable in the chain by index. |
int |
getThrowableCount()
Returns the number of nested
Throwable s represented by
this Nestable , including this Nestable . |
java.lang.Throwable[] |
getThrowables()
Returns this
Nestable and any nested Throwable s
in an array of Throwable s, one element for each
Throwable . |
int |
indexOfThrowable(java.lang.Class type)
Returns the index of the first occurrence of the specified type.
|
int |
indexOfThrowable(java.lang.Class type,
int fromIndex)
Returns the index of the first occurrence of the specified type starting
from the specified index.
|
void |
printPartialStackTrace(java.io.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(java.io.PrintStream out)
Prints the stack trace of this exception to the specified stream.
|
void |
printStackTrace(java.io.PrintWriter out)
Prints the stack trace of this exception to the specified writer.
|
public NotImplementedException()
NotImplementedException
with default message.public NotImplementedException(java.lang.String msg)
NotImplementedException
with specified
detail message.msg
- the error message.public NotImplementedException(java.lang.Throwable cause)
NotImplementedException
with specified
nested Throwable
and default message.cause
- the exception that caused this exception to be thrownpublic NotImplementedException(java.lang.String msg, java.lang.Throwable cause)
NotImplementedException
with specified
detail message and nested Throwable
.msg
- the error messagecause
- the exception that caused this exception to be thrownpublic NotImplementedException(java.lang.Class clazz)
NotImplementedException
referencing the specified class.clazz
- the Class
that has not implemented the methodpublic java.lang.Throwable getCause()
public java.lang.String getMessage()
getMessage
in interface Nestable
getMessage
in class java.lang.Throwable
public java.lang.String getMessage(int index)
Throwable
in the chain
of Throwable
s at the specified index, numbered from 0.getMessage
in interface Nestable
index
- the index of the Throwable
in the chainThrowable
at the
specified index in the chain does not contain a messagejava.lang.IndexOutOfBoundsException
- if the index
argument is
negative or not less than the count of Throwable
s in the chainpublic java.lang.String[] getMessages()
Throwable
objects.
Each throwable returns a message, a null string is included in the array if
there is no message for a particular Throwable
.getMessages
in interface Nestable
public java.lang.Throwable getThrowable(int index)
Throwable
in the chain by index.getThrowable
in interface Nestable
index
- the index to retrieveThrowable
java.lang.IndexOutOfBoundsException
- if the index
argument is
negative or not less than the count of Throwable
s in the chainpublic int getThrowableCount()
Throwable
s represented by
this Nestable
, including this Nestable
.getThrowableCount
in interface Nestable
public java.lang.Throwable[] getThrowables()
Nestable
and any nested Throwable
s
in an array of Throwable
s, one element for each
Throwable
.getThrowables
in interface Nestable
Throwable
spublic int indexOfThrowable(java.lang.Class type)
-1
is returned.indexOfThrowable
in interface Nestable
type
- the type to search forpublic int indexOfThrowable(java.lang.Class type, int fromIndex)
-1
is returned.indexOfThrowable
in interface Nestable
type
- the type to search forfromIndex
- the index of the starting position in the chain to be searchedjava.lang.IndexOutOfBoundsException
- if the fromIndex
argument
is negative or not less than the count of Throwable
s in the chainpublic void printStackTrace()
printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintStream out)
printStackTrace
in interface Nestable
printStackTrace
in class java.lang.Throwable
out
- the stream to write topublic void printStackTrace(java.io.PrintWriter out)
printStackTrace
in interface Nestable
printStackTrace
in class java.lang.Throwable
out
- the writer to write topublic final void printPartialStackTrace(java.io.PrintWriter out)
printPartialStackTrace
in interface Nestable
out
- the writer to write toCopyright © 2010 - 2020 Adobe. All Rights Reserved