lombok-pg -

lombok
Annotation Type Rethrow


@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.
 

value

public abstract Class<? extends Exception>[] value
Specifies the exception types, that should be caught and rethrown. Default is Exception.class.

Default:
{}

as

public abstract Class<? extends Exception> as
Specifies the exception type, that wraps the caught exceptions. Default is RuntimeException.class.

Default:
java.lang.RuntimeException.class

message

public abstract String message
Specifies the message used for the new exception, default is no message.

Default:
""

lombok-pg -

Copyright © 2010-2011 Philipp Eichhorn, licensed under the MIT licence.