Detecting from where code is called

Detect if current piece of code is called by own classes: [code lang=”java”] /** * @return True if current execution points originates from own classes */ public static boolean isOwn() { StackTraceElement[] stack = Thread.currentThread().getStackTrace(); int len = stack.length; for (int i = 2; i < len; i++) { if (stack[i].getClassName().startsWith("org.kari.")) { return true; }...

Read more