Hi Chris,

The PR is submitted two days ago, https://github.com/apache/plc4x/pull/305.

I think it’s better to minimize library dependency, expecially the library is 
only used in one place.

Yang Lin

发件人: Christofer Dutz<mailto:christofer.d...@c-ware.de>
发送时间: 2022年1月21日 19:17
收件人: dev@plc4x.apache.org<mailto:dev@plc4x.apache.org>
主题: RE: [DISCUSS] Remove commons-beanutils dependency

But I agree with Yang,

The fix should be trivial and I would really be happy if we got a PR from him 
:-)

Chris

-----Original Message-----
From: Sebastian Rühl <sru...@apache.org>
Sent: Freitag, 21. Januar 2022 11:01
To: dev@plc4x.apache.org
Subject: Re: [DISCUSS] Remove commons-beanutils dependency

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