---
title: "could not find a getter for ... in class ... 异常的解决方案"
author: "wode66"
date: "2011-10-11T10:23:26Z"
tags: []
categories: ["编程语言"]
slug: "could-not-find-a-getter-for-in-class"
draft: false
lastmod: "2011-10-11T10:23:26Z"
id: 1189327
url: "https://suo.iteye.com/blog/1189327"
---

could not find a getter for cId in class xxx 异常的解决方案

 

这里提一下：**get/set是不是不允许方法名中有连续两个大写字母**

 

public String getODPType(){  
return this.oDPType;  
}

public void setODPType(String oDPType){  
this.oDPType = oDPType;  
}

这样写它就会报错，报找不到getter for oDPType的错误，但下面这样写就可以了  
public String odpType;  
public String getOdpType(){  
return this.odpType;  
}

public void setOdpType(String odpType){  
this.odpType = odpType;  
}