Facility to remove duplication from annotation
one cross-cutting concern less to worry about
Brought to you by:
yilativs
Consider:
@Log(enterLevel=Level.NONE, exitLevel=Level.NONE, on=@Exceptions(level=Level.NONE)) public int methodA(String s){ ... } @Log(enterLevel=Level.NONE, exitLevel=Level.NONE, on=@Exceptions(level=Level.NONE)) public String methodB(int i){ ... } @Log(enterLevel=Level.NONE, exitLevel=Level.NONE, on=@Exceptions(level=Level.NONE)) public void methodB(int i){ ... }
The documentation should show how to configure aspect4log to remove the duplication:
@Log(enterLevel=Level.NONE, exitLevel=Level.NONE, on=@Exceptions(level=Level.NONE))
That is, it should be possible to configure the default logging behaviour for logged classes. For example:
@Log public void methodB(int i){ ... }
Then:
<aspect4logConfiguration> <defaultAnnotations> <annotation> <enterLevel>Level.NONE</enterLevel> <exitLevel>Level.NONE</exitLevel> <on>@Exceptions(level=Level.NONE)</on> </annotation> <defaultAnnotations> </aspect4logConfiguration>
This is simpler than defining custom aspects. The annotation scope could be refined:
<annotation> // all packages, all classes, all methods <annotation package="java.lang"> // all classes & methods in java.lang <annotation package="java.lang" class="String"> // all methods in String <annotation package="java.lang" class="String" method="toString"> // specific <annotation method="toString"> // all methods named toString <annotation package="java.lang" method="get*"> // all get accessors <annotation class="*Factory"> // all methods for all factory classes