...
public String doSmtg(String input) {
log.info("method a trying to do b with params c..");
var result = doIt();
log.info("method a will return b..");
return result;
}
...
...
public String doSmtg(String input) {
var start = Timer.now();
log.info("method a trying to do b with params c..");
var result = doIt();
var end = Timer.end()
log.info("method a will return b.. in: " + end-start + "ms");
return result;
}
...
...
public String doSmtg(String input) {
var start = Timer.now();
var parametersDescription = describe(input)
log.info("method a trying to do b with params "
+ parametersDescription + "..");
var result = doIt();
var resultDescription = describe(result)
var end = Timer.end()
log.info("method a will return "+ resultDescription + ".. in: "
+ end-start + "ms");
return result;
}
...
...
public String doSmtg(String input) {
var start = Timer.now();
var parametersDescription = describe(input)
log.info("method a trying to do b with params "
+ parametersDescription + "..");
var result = doIt();
var resultDescription = describe(result)
var end = Timer.end()
log.info("method a will return "+ resultDescription + ".. in: "
+ end-start + "ms");
return result;
}
...
@Log
metoda X spuštěna s parametry Y.
public class TestService {
public String method(String input) {
return "result";
}
}
public class Aspect {
public String doIt(Origin originExecution) {
log.info("log me");
return originExecution.execute();
}
}
public class TestService {
@Log
public String method(String input) {
return "result";
}
}
public class Aspect {
@"Pověs toto nad metodu která má na sobě @Log"
public String doIt(Origin originExecution) {
log.info("log me");
return originExecution.execute();
}
}
public class TestService {
@Log
public String method(String input) {
log.info("log me");
return "result";
}
}
JWM
CLASS
COMPILED
CLASS
OBJ. INSTANCE
JWM
CLASS
COMPILED
CLASS
OBJ. INSTANCE
PROXY
JWM
CLASS
COMPILED
CLASS
OBJ. INSTANCE
INJECT CODE WHILE CLASS LOADING
JWM
CLASS
COMPILED
CLASS
OBJ. INSTANCE
INJECT CODE WHILE OR AFTER CLASS COMPILATION
Pozor descriptory pracují s předanými daty a pokud imlementujete vlastní MUSÍTE hlídat že data která chcete nejsou null atd..