lombok
Annotation Type Rethrows
@Target(value=METHOD)
@Retention(value=SOURCE)
public @interface Rethrows
Helps defining complex Rethrow statements.
With lombok:
@Rethrows({
@Rethrow(IOException.class),
@Rethrow(value=NullPointerException.class,as=IllegalArgumentException.class)
})
void testMethod(Object arg) {
// do something
}
void testMethod() throw IOException as RuntimeException, NullPointerException as IllegalArgumentException {
// do something
}
Vanilla Java:
void testMethod(Object arg) {
try {
// do something
} catch (IOException e1) {
throw new RuntimeException(e1);
} catch (NullPointerException e2) {
throw new IllegalArgumentException(e2);
}
}
value
public abstract Rethrow[] value
Copyright © 2010-2011 Philipp Eichhorn, licensed under the MIT licence.