KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > services > impl > ClassFinderImpl


1 package org.apache.tapestry.services.impl;
2
3 import org.apache.hivemind.ClassResolver;
4 import org.apache.tapestry.TapestryUtils;
5 import org.apache.tapestry.services.ClassFinder;
6
7 /**
8  * Implemenation of service tapestry.ClassFinder.
9  *
10  * @author Howard Lewis Ship
11  * @since 4.0
12  */

13 public class ClassFinderImpl implements ClassFinder
14 {
15     private ClassResolver _classResolver;
16
17     public Class JavaDoc findClass(String JavaDoc packageList, String JavaDoc className)
18     {
19         String JavaDoc[] packages = TapestryUtils.split(packageList);
20
21         for (int i = 0; i < packages.length; i++)
22         {
23             String JavaDoc fullName = packages[i].trim() + "." + className;
24
25             Class JavaDoc result = _classResolver.checkForClass(fullName);
26
27             if (result != null)
28                 return result;
29         }
30
31         return _classResolver.checkForClass(className);
32     }
33
34     public void setClassResolver(ClassResolver classResolver)
35     {
36         _classResolver = classResolver;
37     }
38
39 }
40
Popular Tags