1 /*
2 * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3 * the spring framework, http://el4j.sf.net
4 * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5 * 1000 Lausanne, Switzerland, http://www.elca.ch
6 *
7 * EL4J is published under the GNU Lesser General Public License (LGPL)
8 * Version 2.1. See http://www.gnu.org/licenses/
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * For alternative licensing, please contact info@elca.ch
16 */
17
18 package ch.elca.el4j.tests.util.metadata.annotations;
19
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23 //Checkstyle: MagicNumber off
24 /**
25 * This class contains a method called test(int) with annotation declarations.
26 *
27 * @svnLink $Revision: 3875 $;$Date: 2009-08-04 14:35:53 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/core/src/test/java/ch/elca/el4j/tests/util/metadata/annotations/FooImpl.java $
28 *
29 * @author Raphael Boog (RBO)
30 * @author Martin Zeltner (MZE)
31 */
32 public class FooImpl implements Foo {
33
34 /**
35 * Inner class for testing interception.
36 */
37 public static class Bar {
38 /**
39 * Private logger of this inner class.
40 */
41 private static Logger s_innerLogger = LoggerFactory.getLogger(Bar.class);
42
43 /**
44 * This method does a log.
45 */
46 public void doLog() {
47 s_innerLogger.info("Hello, I do log something.");
48 }
49 }
50
51 /**
52 * The BASE constant.
53 */
54 public static final int BASE = 3;
55
56 /**
57 * Private logger of this class.
58 */
59 private static Logger s_logger = LoggerFactory.getLogger(FooImpl.class);
60
61 /**
62 * The base member variable.
63 */
64 private int m_base = BASE;
65
66 /**
67 * {@inheritDoc}
68 */
69 @ExampleAnnotationOne(factor = 5)
70 @ExampleAnnotationTwo(factor = 9)
71 public int test(int number) {
72 s_logger.info("Multiplication of base (=" + m_base + ") and number (="
73 + number + ").");
74 m_base = m_base * number;
75 return m_base;
76 }
77
78 /**
79 * {@inheritDoc}
80 */
81 @ExampleAnnotationOne(factor = 5)
82 @ExampleAnnotationTwo(factor = 9)
83 public int test(int number, FooImpl.Bar innerClass) {
84 innerClass.doLog();
85 s_logger.info("Multiplication of base (=" + m_base + ") and number (="
86 + number + ") in method with inner class as parameter.");
87 m_base = m_base * number;
88 return m_base;
89 }
90
91 /**
92 * The getter method for the base member.
93 *
94 * @return the base
95 */
96 public int getBase() {
97 return m_base;
98 }
99
100 /**
101 * The setter method for the base member.
102 *
103 * @param base
104 * the base to set
105 */
106 public void setBase(int base) {
107 m_base = base;
108 }
109 }
110 //Checkstyle: MagicNumber on