Populates the specified bean with data from the specified map.

@param bean The object to populate.
@param params The map to populate the bean with.
334835
public static void populateBean(final Object bean, 
        final Map<String, String> params) {
        final Method[] methods = bean.getClass().getMethods();
        for (final Method method : methods) {
            final Class<?>[] types = method.getParameterTypes();
            final int length = types.length;
            if (length != 1) {
                continue;
            }
            final String name = method.getName();
            if (!name.startsWith("set")) {
                continue;
            }
            final String fieldName = name.substring(3).toLowerCase();
            final String str = params.get(fieldName);
            if (str == null) {
                continue;
            }

            final String val = str.trim();
            
            final Class<?> type = types[0];
            
            final Object toAssign;
            if (type.isAssignableFrom(String.class)) {
                toAssign = val;
            }
            else if (type.isAssignableFrom(int.class)) {
                toAssign = Integer.parseInt(val);
            }
            else if (type.isAssignableFrom(boolean.class)) {
                toAssign = toBoolean(val);
            }
            else if (type.isAssignableFrom(Boolean.class)) {
                toAssign = toBoolean(val);
            }
            else if (type.isAssignableFrom(File.class)) {
                toAssign = new File(val);
            }
            else if (type.isAssignableFrom(URI.class)) {
                try {
                    toAssign = new URI(val);
                } catch (final URISyntaxException e) {
                    LOG.error("Error building bean", e);
                    throw new IllegalArgumentException("Error building bean",e);
                }
            }
            else if (type.isAssignableFrom(Integer.class)) {
                toAssign = Integer.parseInt(val);
            }
            else if (type.isAssignableFrom(int.class)) {
                toAssign = Integer.parseInt(val);
            }
            else if (type.isAssignableFrom(Float.class)) {
                toAssign = Float.parseFloat(val);
            }
            else if (type.isAssignableFrom(float.class)) {
                toAssign = Float.parseFloat(val);
            }
            else if (type.isAssignableFrom(Double.class)) {
                toAssign = Double.parseDouble(val);
            }
            else if (type.isAssignableFrom(double.class)) {
                toAssign = Double.parseDouble(val);
            }
            else if (type.isAssignableFrom(Long.class)) {
                toAssign = Long.parseLong(val);
            }
            else if (type.isAssignableFrom(long.class)) {
                toAssign = Long.parseLong(val);
            }
            else {
                final String msg = "Could not handle type: {}"+type.getName()+
                    " key: "+fieldName;
                LOG.error(msg);
                throw new IllegalArgumentException(msg);
            }
            try {
                method.invoke(bean, toAssign);
            } catch (final IllegalArgumentException e) {
                LOG.error("Could not invoke method", e);
            } catch (final IllegalAccessException e) {
                LOG.error("Could not invoke method", e);
            } catch (final InvocationTargetException e) {
                LOG.error("Could not invoke method", e);
            }
        }
    }
1215900
@Override
    public P get(Bean bean) {
        try {
            return (P) getter.invokeExact(bean);
        } catch (RuntimeException | Error ex) {
            throw ex;
        } catch (Throwable ex) {
            throw new RuntimeException(ex);
        }
    }
561619
@SuppressWarnings("rawtypes")
    public void play2(ObjectMap params) {
        log.debug("play2 options: {}", params);
        Map<String, Object> playOptions = new HashMap<String, Object>();
        for (Object key : params.keySet()) {
            String k = key.toString();
            log.trace("Parameter: {}", k);
            playOptions.put(k, params.get(k));
        }
        play2(playOptions);
    }
134321
public void setEnterpriseBean(Object bean) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "setEnterpriseBean : " + Util.identity(bean));
        ivEjbInstance = bean;
    }
696839
@Override
	public void setBean(final Object bean) {
		BeanAndProviderBoundComponentModel model = getOrCreateComponentModel();
		model.setBean(bean);

		if (getBeanProperty() == null) {
			setBeanProperty(".");
		}
		// Remove values in scratch map
		removeBeanFromScratchMap();
	}
770856
public void populate(Map<String, String[]> map)
    {
        for (Entry<String, String[]> entry : map.entrySet())
        {
            String property = entry.getKey();
            if (model.typeMap.containsKey(property))
            {
                String[] values = entry.getValue();
                if (values.length > 1)
                {
                    throw new UnsupportedOperationException(property + " has multivalue " + values);
                }
                if (values.length == 1)
                {
                    set(property, values[0]);
                }
            }
        }
    }
352407
public void addField(ModelFieldBean bean) {
		Assert.notNull(bean, "ModelFieldBean must not be null");

		this.fields.put(bean.getName(), bean);
	}
266263
public void setParameters(Map<String, String> parameters) {

        if (m_parameters != null) {
            throw new IllegalStateException();
        }
        m_parameters = parameters;
    }
848930
public ExpressionParser addMapper(Object bean)
    {
        mapperList.add((s)->ExpressionParser.getValue(bean, s));
        return this;
    }
1156895
@SuppressWarnings({ "rawtypes" })
   public <T> T executeForBean(int sqlId, Map<String, ? extends Object> bindParams, Class bean) {
      String sql = context.getResources().getString(sqlId);
      return executeForBean(sql, bindParams, bean);
   }
622141
public static void populate(Object target, Map properties) throws BeanMappingException {
        BeanMap map = BeanMap.create(target.getClass());
        map.populate(target, properties);
    }
15710
public static void addToParameters(final IRequestParameters parameters,
		final Map<String, List<StringValue>> parameterMap)
	{
		for (final String parameterName : parameters.getParameterNames())
		{
			final List<StringValue> parameterValues = parameters.getParameterValues(parameterName);
			parameterMap.put(parameterName, parameterValues);
		}
	}
140237
@Override
    public void setParameter(Map<String, String> paraMap) {
        if (paraMap.containsKey("k")) {
            this.k = Integer.parseInt(paraMap.get("k"));
        }
        if (paraMap.containsKey("mode")) {
            this.mode = Integer.parseInt(paraMap.get("mode"));
        }
    }
165620
public void fillParameterValues(Map<String, Object> valuesMap) {
        AssertUtils.assertNotNull(valuesMap, "Value map cannot be null");

        if (this.sqlParameterNames != null) {

            String parameterName = null;
            this.sqlParameterValues = new ArrayList<Object>();

            // using for instead of iterator because this way I control position
            // I am getting.
            for (int i = 0; i < this.sqlParameterNames.size(); i++) {
                parameterName = this.sqlParameterNames.get(i);

                if (valuesMap.containsKey(parameterName) == true) {
                    this.sqlParameterValues.add(valuesMap.get(parameterName));
                } else {
                    throw new IllegalArgumentException(String.format(HandlersConstants.ERROR_PARAMETER_NOT_FOUND, parameterName));
                }
            }
        }
    }
1266670
public static void addParameters(final IRequestParameters parameters,
		final Map<String, String[]> parameterMap)
	{
		final Set<String> parameterNames = parameters.getParameterNames();
		for (final String parameterName : parameterNames)
		{
			final List<StringValue> parameterValues = parameters.getParameterValues(parameterName);
			String[] stringArray = { };
			if ((parameterValues != null) && !parameterValues.isEmpty())
			{
				stringArray = new String[parameterValues.size()];
				for (int i = 0; i < parameterValues.size(); i++)
				{
					stringArray[i] = parameterValues.get(i).toString();
				}
				if (parameterMap.containsKey(parameterName))
				{
					stringArray = ArrayUtils.addAll(parameterMap.get(parameterName), stringArray);
				}
			}
			parameterMap.put(parameterName, stringArray);
		}
	}
1175801
public void parseBeanMap(Object bean, SerializerJson deser)
  {
    Event event;

    while ((event = next()) == Event.KEY_NAME) {
      String fieldName = getString();

      deser.readField(this, bean, fieldName);
    }

    if (event != Event.END_OBJECT) {
      throw new JsonParsingException(L.l("Unexpected JSON {0} while parsing Java object {1}",
                                        event,
                                        bean));
    }
  }
525148
private static void setParams(Map<String, ?> map) {
        for (String name : map.keySet()) {
            setParam(name, map.get(name));
        }
    }