01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.util.functions;
11:
12: import java.lang.reflect.*;
13: import org.mmbase.util.logging.*;
14:
15: /**
16: *
17: * @author Michiel Meeuwissen
18: * @version $Id: BeanFunctionProvider.java,v 1.3 2007/11/25 18:25:49 nklasens Exp $
19: * @see org.mmbase.util.functions.BeanFunction
20: * @since MMBase-1.9
21: */
22: public class BeanFunctionProvider extends FunctionProvider {
23: private static final Logger log = Logging
24: .getLoggerInstance(BeanFunctionProvider.class);
25:
26: public BeanFunctionProvider(Class<?> clazz) {
27: for (Method m : clazz.getMethods()) {
28: if (m.getParameterTypes().length == 0) {
29: try {
30: addFunction(BeanFunction.getFunction(clazz, m
31: .getName()));
32: } catch (Exception e) {
33: log.error("For " + m.getName() + " of " + clazz
34: + " : " + e.getMessage());
35: }
36: }
37: }
38: }
39:
40: }
|