public void inject()

in src/main/java/org/ini4j/spi/BeanTool.java [79:119]


    public void inject(BeanAccess props, Object bean)
    {
        for (PropertyDescriptor pd : getPropertyDescriptors(bean.getClass()))
        {
            try
            {
                Method method = pd.getReadMethod();

                if ((method != null) && !"class".equals(pd.getName()))
                {
                    Object value = method.invoke(bean, (Object[]) null);

                    if (value != null)
                    {
                        if (pd.getPropertyType().isArray())
                        {
                            for (int i = 0; i < Array.getLength(value); i++)
                            {
                                Object v = Array.get(value, i);

                                if ((v != null) && !v.getClass().equals(String.class))
                                {
                                    v = v.toString();
                                }

                                props.propAdd(pd.getName(), (String) v);
                            }
                        }
                        else
                        {
                            props.propSet(pd.getName(), value.toString());
                        }
                    }
                }
            }
            catch (Exception x)
            {
                throw new IllegalArgumentException("Failed to set property: " + pd.getDisplayName(), x);
            }
        }
    }