CGLIB BeanMap set Field first letter to uppercase

41 Views Asked by At

In my application, I need to load some Class from jar. I use BeanMap for read/write loaded class. When I read field, BeanMap return null value. The instance is valid, but this field has a value and cannot be empty. So I debugged and found that the field name was converted to something unexpected.

In this case, I will load jar in my application. So I use BeanMap for read/write loaded class. This is how I create BeanMap:

for (Class clazz : classes) {
    generator.setBeanClass(clazz);
    beanMap.put(clazz.getName(), generator.create());
 }

These Classes will use sameone BeanMap.Generetor. But some Class Field name be like this:

private Object dXIputXOM;


public Object getDXIputXOM() {
   return this.dXIputXOM;
}

public void setDXIputXOM(Object var1) {
   this.dXIputXOM = var1;
}

When I need to access these properties, I do this:

public Object getProperty(Object target,String field) {
    BeanMap beanMap = beanMap.get(target.getClass().getName());
    return beanMap.get(target,field);
} 

At this point, I can't read dXIputXOM field. After debug, I saw the dxInputXOM resovled as DXIputXOM

debug image

What should I do to have BeanMap resolve the field to dxInputXOM?

PS:i use cglib in Spring Core 5.3.25

0

There are 0 best solutions below