Package com.sun.enterprise.util
Class BeanUtils
java.lang.Object
com.sun.enterprise.util.BeanUtils
Static methods which are handy to manipulate java beans
- Author:
- martinmares
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLoads all getters to the Map.static Collection<Method> getGetters(Object bean) static Methodstatic Collection<Method> getSetters(Object bean) static voidSets values from map to provided bean.static StringExtract attribute name from getter or setter.
-
Constructor Details
-
BeanUtils
public BeanUtils()
-
-
Method Details
-
beanToMap
Loads all getters to the Map.- Throws:
InvocationTargetException
-
mapToBean
public static void mapToBean(Object bean, Map<String, Object> data, boolean ignoreNotExistingSetter) throws InvocationTargetException, IllegalArgumentExceptionSets values from map to provided bean.- Parameters:
bean- Set to its settersdata- key is attribute name and value is value to setignoreNotExistingSetter- iffalseand data contains key which does not point to any setter then IllegalArgumentException will be thrown- Throws:
InvocationTargetExceptionIllegalArgumentException
-
getGetters
-
getSetters
-
toAttributeName
Extract attribute name from getter or setter.- Returns:
- IllegalArgumentException if method is not getter or setter.
- Throws:
IllegalArgumentException
-
getSetter
-