Coverage Report - org.seasar.uruma.component.factory.desc.TagHandlerBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
TagHandlerBuilder
0%
0/19
0%
0/4
0
 
 1  
 /*
 2  
  * Copyright 2004-2008 the Seasar Foundation and the Others.
 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, 
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.uruma.component.factory.desc;
 17  
 
 18  
 import java.lang.reflect.Constructor;
 19  
 import java.util.List;
 20  
 
 21  
 import org.seasar.framework.beans.BeanDesc;
 22  
 import org.seasar.framework.beans.factory.BeanDescFactory;
 23  
 import org.seasar.framework.util.OgnlUtil;
 24  
 import org.seasar.framework.xml.TagHandler;
 25  
 
 26  0
 public class TagHandlerBuilder {
 27  
     public static TagHandler buildTagHandler(final UrumaComponentDesc desc)
 28  
             throws ClassNotFoundException {
 29  0
         Object[] args = getArgs(desc);
 30  0
         Class<?>[] argTypes = getArgTypes(args);
 31  
 
 32  0
         String clazz = desc.getTagHandlerClass();
 33  0
         BeanDesc bd = BeanDescFactory.getBeanDesc(Class.forName(clazz));
 34  0
         Constructor<?> constructor = bd.getConstructor(argTypes);
 35  
 
 36  0
         return null;
 37  
     }
 38  
 
 39  
     protected static Object[] getArgs(final UrumaComponentDesc desc) {
 40  0
         int size = desc.getTagHandlerArgs().size();
 41  0
         List<String> argExprs = desc.getTagHandlerArgs();
 42  0
         Object[] args = new Object[size];
 43  0
         for (int i = 0; i < size; i++) {
 44  0
             Object exp = OgnlUtil.parseExpression(argExprs.get(i));
 45  0
             args[i] = OgnlUtil.getValue(exp, null);
 46  
         }
 47  0
         return args;
 48  
     }
 49  
 
 50  
     protected static Class<?>[] getArgTypes(final Object[] args) {
 51  0
         Class<?>[] types = new Class<?>[args.length];
 52  0
         for (int i = 0; i < args.length; i++) {
 53  0
             Object object = args[i];
 54  0
             types[i] = object.getClass();
 55  
         }
 56  0
         return types;
 57  
     }
 58  
 }