1 16 package com.ibatis.sqlmap.engine.accessplan; 17 18 import com.ibatis.common.beans.ClassInfo; 19 20 import java.lang.reflect.Method ; 21 22 25 public abstract class BaseAccessPlan implements AccessPlan { 26 27 protected Class clazz; 28 protected String [] propertyNames; 29 protected ClassInfo info; 30 31 BaseAccessPlan(Class clazz, String [] propertyNames) { 32 this.clazz = clazz; 33 this.propertyNames = propertyNames; 34 info = ClassInfo.getInstance(clazz); 35 } 36 37 protected Class [] getTypes(String [] propertyNames) { 38 Class [] types = new Class [propertyNames.length]; 39 for (int i = 0; i < propertyNames.length; i++) { 40 types[i] = info.getGetterType(propertyNames[i]); 41 } 42 return types; 43 } 44 45 protected Method [] getGetters(String [] propertyNames) { 46 Method [] methods = new Method [propertyNames.length]; 47 for (int i = 0; i < propertyNames.length; i++) { 48 methods[i] = info.getGetter(propertyNames[i]); 49 } 50 return methods; 51 } 52 53 protected Method [] getSetters(String [] propertyNames) { 54 Method [] methods = new Method [propertyNames.length]; 55 for (int i = 0; i < propertyNames.length; i++) { 56 methods[i] = info.getSetter(propertyNames[i]); 57 } 58 return methods; 59 } 60 61 protected String [] getGetterNames(String [] propertyNames) { 62 String [] names = new String [propertyNames.length]; 63 for (int i = 0; i < propertyNames.length; i++) { 64 names[i] = info.getGetter(propertyNames[i]).getName(); 65 } 66 return names; 67 } 68 69 protected String [] getSetterNames(String [] propertyNames) { 70 String [] names = new String [propertyNames.length]; 71 for (int i = 0; i < propertyNames.length; i++) { 72 names[i] = info.getSetter(propertyNames[i]).getName(); 73 } 74 return names; 75 } 76 77 78 } 79 | Popular Tags |