Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ReflectedGroupClazzLoader |
|
| 1.5;1.5 |
1 | /* | |
2 | * Copyright 2002-2004 The Apache Software Foundation | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.apache.commons.clazz.reflect; | |
17 | ||
18 | import org.apache.commons.clazz.ClazzLoader; | |
19 | import org.apache.commons.clazz.ModelClazzLoader; | |
20 | import org.apache.commons.clazz.common.GroupClazzLoader; | |
21 | ||
22 | /** | |
23 | * A clazz loader that groups multiple <code>ReflectedClazzLoaders</code>. | |
24 | * Its primary purpose is to optimize the methods that are executed the same way | |
25 | * by all <code>ReflectedClazzLoaders</code>, specifically the | |
26 | * <code>getClazzName()</code> method, which is always the same as the | |
27 | * corresponding <b>class</b> name | |
28 | * | |
29 | * @author <a href="mailto:dmitri@apache.org">Dmitri Plotnikov</a> | |
30 | * @version $Id: ReflectedGroupClazzLoader.java 155436 2005-02-26 13:17:48Z dirkv $ | |
31 | */ | |
32 | public class ReflectedGroupClazzLoader extends GroupClazzLoader { | |
33 | ||
34 | public ReflectedGroupClazzLoader(ModelClazzLoader modelClazzLoader) { | |
35 | 0 | super(modelClazzLoader); |
36 | 0 | } |
37 | ||
38 | public boolean canAddClazzLoader(ClazzLoader loader) { | |
39 | 0 | return loader instanceof ReflectedClazzLoader; |
40 | } | |
41 | ||
42 | /** | |
43 | * @see org.apache.commons.clazz.ClazzLoader#isMember(java.lang.Object) | |
44 | */ | |
45 | public boolean isMember(Object instance) { | |
46 | 0 | return true; |
47 | } | |
48 | ||
49 | /** | |
50 | * @see org.apache.commons.clazz.ClazzLoader#getClazzName(java.lang.Object) | |
51 | */ | |
52 | public String getClazzName(Object instance) { | |
53 | 0 | if (instance == null) { |
54 | 0 | return null; |
55 | } | |
56 | 0 | return instance.getClass().getName(); |
57 | } | |
58 | } |