Returns a fixed-size map backed by the given bean. Map remove operations
are unsupported, as is access to excluded properties.

@throws IllegalArgumentException if bean is null
972909
public static SortedMap<String, Object> asMap(Object bean) {
        if (bean == null) {
            throw new IllegalArgumentException();
        }
        BeanPropertyMapFactory factory = forClass(bean.getClass());
        return factory.createMap(bean);
    }
112647
public <T> T toBean(Class<T> clazz) {
		return BeanUtil.mapToBean(this, clazz, false);
	}
745208
public static Map<String, Object> getBeansWithAnnotation(ApplicationContext appContext,
            Class<? extends Annotation> annotationType) {
        try {
            return appContext.getBeansWithAnnotation(annotationType);
        } catch (BeansException e) {
            return new HashMap<String, Object>();
        }
    }
752673
public <T> T toBeanIgnoreCase(T bean) {
		BeanUtil.fillBeanWithMapIgnoreCase(this, bean, false);
		return bean;
	}
319188
public Contextual<?> getBean(Object beanKey)
    {
        if (passivationCapable)
        {
            return beanManager.getPassivationCapableBean((String) beanKey);
        }
        else
        {
            return (Contextual<?>) beanKey;
        }
    }
21903
public static <T> T mapToBean(Map<?, ?> map, Class<T> beanClass, boolean isIgnoreError) {
		return fillBeanWithMap(map, ReflectUtil.newInstance(beanClass), isIgnoreError);
	}
782310
public <T> T getBean(K key, Class<T> beanType) {
		final JSONObject obj = getJSONObject(key);
		return (null == obj) ? null : obj.toBean(beanType);
	}
968312
public Map<String, String> getFieldMap() {
		if (headerMap == null) {
			throw new IllegalStateException("No header available");
		}

		final Map<String, String> fieldMap = new LinkedHashMap<>(headerMap.size());
		String key;
		Integer col;
		String val;
		for (final Map.Entry<String, Integer> header : headerMap.entrySet()) {
			key = header.getKey();
			col = headerMap.get(key);
			val = null == col ? null : get(col);
			fieldMap.put(key, val);
		}

		return fieldMap;
	}
656769
public static Object getMappedProperty(Object bean, String name)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, Exception
    {
        if(bean == null)
            throw new IllegalArgumentException("No bean specified");
        if(name == null)
            throw new IllegalArgumentException("No name specified");
        int delim = name.indexOf('(');
        int delim2 = name.indexOf(')');
        if(delim < 0 || delim2 <= delim)
        {
            throw new IllegalArgumentException("Invalid mapped property '" + name + "'");
        } else
        {
            String key = name.substring(delim + 1, delim2);
            name = name.substring(0, delim);
            return getMappedProperty(bean, name, key);
        }
    }
433459
public MapBuilder configureMapDimension(Integer width, Integer height) {
        this.mapHeight = height;
        this.mapWidth = width;
        return this;
    }
35200
@SuppressWarnings("unchecked")
    public static <T> BeanMap<T> filterRequestFields(T src) {
        return (BeanMap<T>) FilteringBeanMap.from(src, parsePathProperties());
    }
906640
public <T> T toBean(T bean, boolean isToCamelCase) {
		BeanUtil.fillBeanWithMap(this, bean, isToCamelCase, false);
		return bean;
	}
448646
public static void getExtensions(Map<String, String> map)
                    throws IllegalArgumentException {
        if (map == null) {
            throw new IllegalArgumentException(
                            "Parameter 'map' can not be null.");
        }
        if (recursion.get() == Boolean.TRUE) {
            return;
        }
        recursion.set(Boolean.TRUE);
        LinkedList<String> cleanup = new LinkedList<String>();
        r.lock();
        try {
            for (Map.Entry<String, WeakReference<Extension>> entry : extensionMap
                            .entrySet()) {
                Extension extension = entry.getValue().get();
                if (extension == null) {
                    cleanup.add(entry.getKey());
                } else {
                    String value = extension.getValue();
                    if (value != null) {
                        map.put(entry.getKey(), value);
                    }
                }
            }
        } finally {
            r.unlock();
            recursion.remove();
        }
        if (cleanup.size() > 0) {
            w.lock();
            try {
                for (String key : cleanup) {
                    WeakReference<Extension> extension = extensionMap
                                    .remove(key);
                    if (extension != null && extension.get() != null) {
                        // Special case! Somebody has put new extension for this
                        // key after we released
                        // read lock and before we took write lock. We need to
                        // put it back.
                        extensionMap.put(key, extension);
                    }
                }
            } finally {
                w.unlock();
            }
        }
        if (extensions.get() != null) {
            for (Entry<String, String> entry : extensions.get().entrySet()) {
                map.put(entry.getKey(), entry.getValue());
            }
        }

    }
834695
public static Map<String, Object> beanToMap(Object bean, Map<String, Object> targetMap, final boolean isToUnderlineCase, boolean ignoreNullValue) {
		if (bean == null) {
			return null;
		}

		return beanToMap(bean, targetMap, ignoreNullValue, new Editor<String>() {

			@Override
			public String edit(String key) {
				return isToUnderlineCase ? StrUtil.toUnderlineCase(key) : key;
			}
		});
	}
596438
public static Mapper beanMapper(final String property){
        return  new Mapper() {
        public Object map(Object a) {
            try {
                return BeanUtils.getProperty(a, property);
            } catch (Exception e) {
                throw new ClassCastException("Object was not the expected class: " + a.getClass());
            }
        }
        };
    }
984636
public <T> T toBeanWithCamelCase(T bean) {
		BeanUtil.fillBeanWithMap(this, bean, true, false);
		return bean;
	}
250294
public static Object convertMapToBean(Map<String, ? extends Object> source, Class<?> target) throws ConversionException {
        Object bean = newInstance(target);
        if (bean == null) {
            //try with just the target name as specified in Trac #352
            bean = newInstance(target.getName());
            if (bean == null) {
                throw new ConversionException("Unable to create bean using empty constructor");
            }
        }
        try {
            BeanUtils.populate(bean, source);
        } catch (Exception e) {
            throw new ConversionException("Error populating bean", e);
        }
        return bean;
    }