@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Counted
@Counted(name = "fancyName")
public String fancyName(String name) {
return "Sir Captain " + name;
}
A counter for the defining class with the name fancyName
will be created and each time the
#fancyName(String)
method is invoked, the counter will be marked.Modifier and Type | Optional Element and Description |
---|---|
boolean |
absolute
If
true , use the given name as an absolute name. |
boolean |
monotonic
If
false (default), counter is decremented when the annotated
method returns, counts current invocations of the annotated method. |
String |
name
The name of the counter.
|
public abstract String name
public abstract boolean absolute
true
, use the given name as an absolute name. If false
, use the given name
relative to the annotated class.public abstract boolean monotonic
false
(default), counter is decremented when the annotated
method returns, counts current invocations of the annotated method.
If true
, counter increases monotonically, counts total number
of invocations of the annotated method.Copyright © 2012-2013. All Rights Reserved.