|
lombok-pg - | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||
@Target(value=METHOD) @Retention(value=SOURCE) public @interface Rethrow
Simplifies rethrowing Exceptions by wrapping them.
With lombok:
@Rethrow(IOException.class)
void testMethod() {
// do something
}
void testMethod() throw IOException as RuntimeException {
// do something
}
Vanilla Java:
void testMethod() {
try {
// do something
} catch (IOException e1) {
throw new RuntimeException(e1);
}
}
| Optional Element Summary | |
|---|---|
Class<? extends Exception> |
as
Specifies the exception type, that wraps the caught exceptions. |
String |
message
Specifies the message used for the new exception, default is no message. |
Class<? extends Exception>[] |
value
Specifies the exception types, that should be caught and rethrown. |
public abstract Class<? extends Exception>[] value
Exception.class.
public abstract Class<? extends Exception> as
RuntimeException.class.
public abstract String message
|
lombok-pg - | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||