Write multi value to bean

@param <P> Type of value to convert
@param bean Bean to set values
@param values List of values to set
169208
@SuppressWarnings("unchecked")
  <P> void setValues(T bean, List<String> values) {
    Collection<P> col;
    try {
      col = (Collection<P>) listType.newInstance();
    } catch (InstantiationException e) {
      throw new RuntimeException("Can't instantiate " + listType, e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException("Can't access default constructor of " + listType);
    }
    for (String value : values) {
      col.add((P) converter.fromCharacters(value));
    }
    ref.writeValue(col, bean);
  }
659906
protected void doUpdateBeanValue(final Object value) {
		String beanProperty = getBeanProperty();
		if (beanProperty != null && beanProperty.length() > 0 && !".".equals(beanProperty)) {
			Object bean = getBean();
			if (bean != null) {
				try {
					Object beanValue = getBeanValue();
					if (!Util.equals(beanValue, value)) {
						PropertyUtils.setProperty(bean, beanProperty, value);
					}
				} catch (Exception e) {
					LOG.error("Failed to set bean property " + beanProperty + " on " + bean);
				}
			}
		}
	}
329229
protected void setBeanPropertyValue(final String property, final Object bean,
			final Serializable value) {
		if (bean == null) {
			return;
		}

		if (".".equals(property)) {
			LOG.error("Set of entire bean is not supported by this model");
			return;
		}
		try {
			PropertyUtils.setProperty(bean, property, value);
		} catch (Exception e) {
			LOG.error("Failed to set bean property " + property + " on " + bean, e);
		}
	}
752900
public static final void setValue(Object bean, String property, Object v)
    {
        Object vv = BeanHelper.getValue(bean, property);
        if (v != null && v.getClass().isArray() &&  vv != null && (vv instanceof Collection))
        {   // array assignment to Collection
            Collection col = (Collection) vv;
            Class[] pt = BeanHelper.getParameterTypes(bean, property);
            col.clear();
            int len = Array.getLength(v);
            for (int ii=0;ii<len;ii++)
            {
                col.add(ConvertUtility.convert(pt[0], Array.get(v, ii)));
            }
        }
        else
        {
            if (v != null && v.getClass().isArray())
            {   // array with single menber
                if (Array.getLength(v) == 1)
                {
                    v = Array.get(v, 0);
                }
            }
            Class<?> type = BeanHelper.getType(bean, property);
            if (v != null)
            {
                v = ConvertUtility.convert(type, v);
            }
            Object value = v;
            doFor(
                bean, 
                property, 
                type,
                (Object a, int i)->{Array.set(a, i, value);return null;},
                (List l, int i)->{l.set(i, value);return null;},
                (Object b, Class c, String p)->{try
                {
                    c.getField(p).set(b, value);return null;
                }
                catch (IllegalArgumentException | IllegalAccessException ex)
                {
                    throw new IllegalArgumentException(ex);
                }
                }, 
                (Object b, Method m)->{try
                {
                    m.invoke(b, value);return null;
                }
                catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException ex)
                {
                    throw new IllegalArgumentException(ex);
                }
                });
        }
    }
612184
public Map<String, Object> write(Bean bean) {
        JodaBeanUtils.notNull(bean, "bean");
        return writeBean(bean, bean.getClass());
    }
128700
public final void setValues(@Nullable final Set<String> values) {
        if (values != null && !values.equals(this.values)) {
            this.values = values;
            persistSet(this.values);
            notifyChanged();
        }
    }
1221243
private void writeBean(Bean bean, Class<?> declaredType, RootType rootTypeFlag) throws IOException {
        output.writeObjectStart();
        // type information
        if (rootTypeFlag == RootType.ROOT_WITH_TYPE || (rootTypeFlag == RootType.NOT_ROOT && bean.getClass() != declaredType)) {
            String typeStr = SerTypeMapper.encodeType(bean.getClass(), settings, basePackage, knownTypes);
            if (rootTypeFlag == RootType.ROOT_WITH_TYPE) {
                basePackage = bean.getClass().getPackage().getName() + ".";
            }
            output.writeObjectKeyValue(BEAN, typeStr);
        }
        // property information
        for (MetaProperty<?> prop : bean.metaBean().metaPropertyIterable()) {
            if (prop.style().isSerializable() || (prop.style().isDerived() && settings.isIncludeDerived())) {
                Object value = SerOptional.extractValue(prop, bean);
                if (value != null) {
                    output.writeObjectKey(prop.name());
                    Class<?> propType = SerOptional.extractType(prop, bean.getClass());
                    if (value instanceof Bean) {
                        if (settings.getConverter().isConvertible(value.getClass())) {
                            writeSimple(propType, value);
                        } else {
                            writeBean((Bean) value, propType, RootType.NOT_ROOT);
                        }
                    } else {
                        SerIterator itemIterator = settings.getIteratorFactory().create(value, prop, bean.getClass());
                        if (itemIterator != null) {
                            writeElements(itemIterator);
                        } else {
                            writeSimple(propType, value);
                        }
                    }
                }
            }
        }
        output.writeObjectEnd();
    }
498236
@Override
    public void putAll(final T[] values) {
        if (values == null || values.length == 0) {
            return;
        }
        for (final T value : values) {
            put(value);
        }
    }
1285780
public void setPropertiesOn(final Bean bean) {
        String[][] properties = getProperties();
        for (int i = 0; i < properties.length; i++) {
            if (properties[i].length < 2) {
                continue;
            }
            for (int j = 0; j < properties[i].length - 1; j++) {
                bean.addProperty(properties[i][0], properties[i][j + 1]);
            }
        }
    }
355378
public void setValuesFor(String values, String name) {
        getMapHelper().setValuesForIn(values, name, getCurrentValues());
    }
91621
public void extractValues(HashMap<String, String> values) {
        for (MultipleSyntaxElements l : childContainers) {
            l.extractValues(values);
        }
    }
1077996
public void write(Object object, Object value) {
        if(object instanceof Map)
            mapUpdate((Map)object, _identifier, value);
        else beanUpdate(object, _identifier, value);
    }
37213
@Override
    public void setValues(String[] values) {
        if (values == null) {
            this.valuesArray = null;
            this.values = null;
            this.nullValues = true;
        } else if (this.values == null) {
            this.values = new ArrayList<>(Arrays.asList(values));
            this.nullValues = false;
            this.valuesArray = values.clone();
        } else {
            this.nullValues = false;
            this.values.clear();
            for (final String value : values) {
                if (value == null) {
                    this.values.add(NULL_MARKER);
                } else {
                    this.values.add(NullSafeStringColumnMapper.NOT_NULL_PREFIX + value);
                }
            }
            this.valuesArray = values.clone();
        }
    }
559628
public T mapObject(final Map<String, String> values) throws Exception {

        T result = createInstance();

        // for each field
        for (Map.Entry<String, String> entry : values.entrySet()) {

            String field = entry.getKey();
            //get field raw value
            String value = values.get(field);

            Method setter = setters.get(field);
            if (setter == null) {
                LOGGER.warn("No public setter found for field {}, this field will be set to null (if object type) or default value (if primitive type)", field);
                continue;
            }

            Class<?> type = setter.getParameterTypes()[0];
            TypeConverter<String, ?> typeConverter = typeConverters.get(type);
            if (typeConverter == null) {
                LOGGER.warn(
                        "Type conversion not supported for type {}, field {} will be set to null (if object type) or default value (if primitive type)",
                        type, field);
                continue;
            }

            if (value == null) {
                LOGGER.warn("Attempting to convert null to type {} for field {}, this field will be set to null (if object type) or default value (if primitive type)", type, field);
                continue;
            }

            if (value.isEmpty()) {
                LOGGER.debug("Attempting to convert an empty string to type {} for field {}, this field will be ignored", type, field);
                continue;
            }

            convertValue(result, field, value, setter, type, typeConverter);

        }

        return result;
    }
928390
public void writeBean(ThirdPartyParseable bean, EndianAwareDataOutputStream os){
		if(bean==null)throw new NullPointerException();
		ensureContextInstantiatedForWriting(os,bean);
		try{bean.describeFormat(this);}
		catch(UnrecognizedFormatException e){e.printStackTrace();}//Shouldn't happen.
		popBean();
		}
1287213
public void addMultiValuedField(String fieldName, List<String> values) {

        if ((values != null) && (values.size() > 0)) {
            for (String value : values) {
                m_doc.addField(fieldName, value);
            }
        }
    }
1332887
@Override
    public void putAll(final Collection<T> values) {
        if (values == null || values.size() == 0) {
            return;
        }
        for (final T value : values) {
            put(value);
        }
    }