You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2025/01/07 14:07:01 UTC
[jira] [Updated] (BEANUTILS-270) findPropertyDescriptor method with a class argument
[ https://issues.apache.org/jira/browse/BEANUTILS-270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory updated BEANUTILS-270:
--------------------------------------
Fix Version/s: 2.0.0-M2
(was: 2.0.0-M1)
> findPropertyDescriptor method with a class argument
> ---------------------------------------------------
>
> Key: BEANUTILS-270
> URL: https://issues.apache.org/jira/browse/BEANUTILS-270
> Project: Commons BeanUtils
> Issue Type: Wish
> Components: Bean / Property Utils
> Affects Versions: 1.7.0
> Reporter: Matthias Wuttke
> Priority: Minor
> Fix For: 2.0.0-M2
>
>
> I would like to suggest to add a findPropertyDescriptor variant that takes a class instead of a bean as an argument. This is useful for situations where I want to deal with abstract classes and their properties as I cannot instantiate them to use findPropertyDescriptor(Object, String)
> public PropertyDescriptor findPropertyDescriptor(Class clazz, String propertyName) {
> PropertyDescriptor[] descriptors = PropertyUtils.getPropertyDescriptors(clazz);
> for (int i = 0; i < descriptors.length; i++)
> if (propertyName.equals(descriptors[i].getName()))
> return (descriptors[i]);
> return null;
> }
> Best regards,
> Matthias
--
This message was sent by Atlassian Jira
(v8.20.10#820010)