Hi Yang,

could you please try bring that issue up to the upstream project? We don't want 
to replicate this logic in PLC4X if this can be solved upstream (at 
common-beanutils). Maybe there is a alternative implementation for java pojos 
that I'am currently not aware of. Other than that it's better to use methods 
supplied by org.apache.commons.lang3.reflect.FieldUtils rather than doing the 
direct implementation like you suggested.

- Sebastian

On 2022/01/19 12:54:22 杨 林 wrote:
> Hi all,
> 
> I’m using plc4j in Android, commons-beanutils is the only thing to obstacle 
> me to do that ,because Android does not have java.beans.PropertyDescriptor.
> 
> org.apache.commons.beanutils.BeanUtils is used only in 
> org.apache.plc4x.java.spi.configuration.ConfigurationFactory (Line 93 and 
> Line 103). I think It could be replace by simple reflect:
> 
> field.setAccessible(true);
> 
> if (field.getType() == String.class) {
>     field.set(instance, valueString);
> } else if ((field.getType() == boolean.class) || (field.getType() == 
> Boolean.class)) {
>     field.setBoolean(instance, Boolean.parseBoolean(valueString));
> } else if …
> 
> Any help?
> 
> Yang Lin
> 

Reply via email to