01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tctest.spring.aop;
05:
06: import java.lang.reflect.Method;
07:
08: import org.springframework.aop.MethodBeforeAdvice;
09:
10: public class SimpleBeforeAdvice implements MethodBeforeAdvice {
11:
12: public void before(Method method, Object[] args, Object target)
13: throws Throwable {
14: Logger.log += "before args(" + makeString(args) + ") this("
15: + target.getClass().getName() + ") ";
16: }
17:
18: private String makeString(Object[] args) {
19: if (null == args) {
20: return "*NULL*";
21: } else if (args.length == 0) {
22: return "*EMPTY*";
23: } else {
24: return "" + args[0];
25: }
26: }
27: }
|