本文整理匯總了Java中java.lang.reflect.Method.getParameterTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java Method.getParameterTypes方法的具體用法?Java Method.getParameterTypes怎麽用?Java Method.getParameterTypes使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.reflect.Method的用法示例。
在下文中一共展示了Method.getParameterTypes方法的19個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: getProperty
點讚 4
import java.lang.reflect.Method; //導入方法依賴的package包/類
public static Object getProperty(Object bean, String property)
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException, SecurityException, IntrospectionException,
NoSuchMethodException {
Object object = null;
Method getter = getReadMethod(bean.getClass(), property);
StringTokenizer st = new StringTokenizer(property, "[](,)", false);
capitalize(st.nextToken());
Object params[] = new Object[st.countTokens()];
for (int j = 0; j < params.length; j++) {
params[j] = st.nextToken();
if (getter.getParameterTypes()[0] == int.class) {
params[j] = new Integer((String) params[j]);
}
}
object = getter == null ? null : getter.invoke(bean, params);
return object;
}
開發者ID:dvbern,項目名稱:doctemplate,代碼行數:19,
示例2: getBeanValue
點讚 3
import java.lang.reflect.Method; //導入方法依賴的package包/類
/**
* 將ResultSet轉換為指定class的Bean.
* @param rs ResultSet實例
* @param rsmd ResultSet元數據
* @param beanClass 空屬性的Bean的class
* @param propMap Bean屬性對應的Map
* @param 泛型方法
* @return 值
* @throws IllegalAccessException IllegalAccessException
* @throws SQLException SQLException
* @throws InvocationTargetException InvocationTargetException
* @throws InstantiationException InstantiationException
*/
public static T getBeanValue(ResultSet rs, ResultSetMetaData rsmd, Class beanClass,
Map propMap) throws IllegalAccessException, SQLException,
InvocationTargetException, InstantiationException {
T bean = beanClass.newInstance();
for (int i = 0, cols = rsmd.getColumnCount(); i < cols; i++) {
String columnName = JdbcHelper.getColumn(rsmd, i + 1);
if (propMap.containsKey(columnName)) {
PropertyDescriptor prop = propMap.get(columnName);
// 獲取並調用setter方法.
Method propSetter = prop.getWriteMethod();
if (propSetter == null || propSetter.getParameterTypes().length != 1) {
log.warn("類'{}'的屬性'{}'沒有標準的setter方法", beanClass.getName(), columnName);
continue;
}
// 得到屬性類型並將該數據庫列值轉成Java對應類型的值
Class> propType = prop.getPropertyType();
Object value = FieldHandlerChain.newInstance().getColumnValue(rs, i + 1, propType);
propSetter.invoke(bean, value);
}
}
return bean;
}
開發者ID:blinkfox,項目名稱:adept,代碼行數:37,
示例3: LevelDListener
點讚 3
import java.lang.reflect.Method; //導入方法依賴的package包/類
public LevelDListener(Method method) {
NullCheck.check(method, "method");
this.method = method;
// check the annotation
if (getAnnotation() == null) {
throw new ListenerMethodParametersException(method, "There is no ObjectListener annotation on the method!", AnnotationListenerRegistrator.this);
}
// check the method signature
if (method.getParameterTypes().length != 1 ||
!method.getParameterTypes()[0].isAssignableFrom(IWorldObjectEvent.class)) {
throw new ListenerMethodParametersException(method, method.getAnnotation(ObjectListener.class), AnnotationListenerRegistrator.this);
}
objectId = getId(method, getAnnotation());
}
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:18,
示例4: covertObjWithMap
點讚 3
import java.lang.reflect.Method; //導入方法依賴的package包/類
/**
* 根據傳遞的參數修改數據
*
* @param o
* @param parameterMap map參數
*/
public static final void covertObjWithMap(Object o, Map parameterMap) {
Class> clazz = o.getClass();
Iterator> iterator = parameterMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = iterator.next();
String key = entry.getKey().trim();<