01: /* MapperClassResolver.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Wed Oct 17 11:40:12 2007, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zkmax.xel.ognl;
20:
21: import java.util.Map;
22:
23: import ognl.ClassResolver;
24:
25: import org.zkoss.lang.Classes;
26: import org.zkoss.xel.FunctionMapper;
27:
28: /**
29: * A class resolver based on {@link FunctionMapper}.
30: *
31: * @author tomyeh
32: * @since 3.0.0
33: */
34: /*package*/class MapperClassResolver implements ClassResolver {
35: private final FunctionMapper _mapper;
36:
37: public MapperClassResolver(FunctionMapper mapper) {
38: _mapper = mapper;
39: }
40:
41: public Class classForName(String className, Map context)
42: throws ClassNotFoundException {
43: final Class cls = _mapper != null ? _mapper
44: .resolveClass(className) : null;
45: return cls != null ? cls : Classes.forNameByThread(className);
46: }
47: }
|