Exception in thread "main" java.beans.IntrospectionException: Method not found: isWBLDINST
来源:互联网 发布:网络维护公司赚钱不 编辑:程序博客网 时间:2024/05/08 23:53
今天做java的项目时
想通过反射为sql查询出的数据进行封装,结果一直报错
Exception in thread "main" java.beans.IntrospectionException: Method not found: isWBLDINSTat java.beans.PropertyDescriptor.<init>(Unknown Source)at java.beans.PropertyDescriptor.<init>(Unknown Source)at GetSet.testRef(GetSet.java:10)at GetSet.main(GetSet.java:19)
但是我的WBLDINST用Eclipse自动生成了get和set方法
后来写个demo调试才发现原来是字段名大小写不一样导致的。
import java.beans.PropertyDescriptor;import java.lang.reflect.Field;import java.lang.reflect.Method;public class GetSet {public static <T>void testRef(Class<T> clazz) throws Exception{T obj = clazz.newInstance();Field[] fields = clazz.getDeclaredFields();for(Field field : fields){PropertyDescriptor descriptor = new PropertyDescriptor("WBLDINST", clazz);Method method = descriptor.getWriteMethod();System.out.println(method.getName());method.invoke(obj, "12");}}public static void main(String[] args) throws Exception {//String s = "desc";//System.out.println("set" + (s.toUpperCase().charAt(0)) + s.substring(1));testRef(A.class);}}class A {private String name;private String wbldInst;public String getName() {return name;}public void setName(String name) {this.name = name;}public String getWbldInst() {return wbldInst;}public void setWbldInst(String wbldInst) {this.wbldInst = wbldInst;}}
0 0
- Exception in thread "main" java.beans.IntrospectionException: Method not found: isWBLDINST
- Exception in thread "main" java.sql.SQLException: ORA-00923: FROM keyword not found where expected
- Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation
- Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException
- java 集合排序异常Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violate
- java 集合排序异常Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violate
- Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its gener
- Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its gener
- Exception in thread "main" java.net.ProtocolException: Invalid HTTP method: get
- Exception in thread "main" java.lang.NoClassDefFoundError
- Exception in thread "main" java.lang.NoClassDefFoundError
- Exception in thread "main" java.lang.NoClassDefFoundError
- Exception in thread "main" java.lang.NoClassDefFoundError
- Exception in thread "main" java.lang.NoClassDefFoundError:
- Exception in thread "main" java.lang.NoClassDefFoundError
- Exception in thread "main" java.lang.NoClassDefFoundError
- Exception in thread "main" java.lang.NoClassDefFoundError
- Exception in thread "main" java.lang.NoClassDefFoundError
- Hadoop默认端口说明
- EXPLORING RX OPERATORS: MAP
- @NotEmpty、@NotBlank、@NotNull
- Android四大组件
- 数据溢出怎么办,别慌别慌,try_catch来帮忙
- Exception in thread "main" java.beans.IntrospectionException: Method not found: isWBLDINST
- 初级php基础知识问答题(答案仅供参考)
- MySQL 数据库还原语句
- JavaScript高级程序设计 第六章 面向对象程序设计
- ubuntu14.04安装CUDA+theano
- android 动画效果
- 為 Swift 代碼編寫含有 Mardown 語法的文檔
- 丈夫自罚引肾衰 还能愉快的性生活吗?
- 重启Activity的方法