just wrote the first batch of code for lego4j
Would you like to be able to write code like this ?
public class Foo {
@RetryOnException( E.class, 1 )
public String bar( int arg1 ) throws E {
return doSomeThingThatMightThrowE( arg1 );
}
}
instead of having to write something like this:
public class Foo {
public String bar( int arg1 ) throws E {
int retries = 0;
while (true) {
try {
return doSomeThingThatMightThrowE( arg1 );
}
catch (E e) {
if (retries < 5) {
continue;
}
throw e;
}
}
}
}
This is what lego4j is about, creating a library of lightweight aspects to encapsulate local concerns programmers encounter while writing a generic Java application.