public final class BeanUtils extends Object
Constructor and Description |
---|
BeanUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
convertValue(String text,
String typeName)
Convert a string value into the true value for typeName using the PropertyEditor associated with typeName.
|
static Class<?> |
findClass(String name) |
static Class<?> |
findClass(String name,
ClassLoader loader) |
static Class<?> |
getPrimitiveTypeForName(String name) |
static Class<?> |
getWrapperTypeFor(Class<?> primitive) |
static boolean |
isNull(String value)
Whether a string is interpreted as the null value, including the empty string.
|
static boolean |
isNull(String value,
boolean trim,
boolean empty)
Whether a string is interpreted as the null value
|
static boolean |
isNullHandlingEnabled()
Will the standard editors return null from their
PropertyEditor.setAsText(String) method for non-primitive targets? |
static void |
mapJavaBeanProperties(Object bean,
Properties beanProps)
This method takes the properties found in the given beanProps to the bean using the property editor registered for the
property.
|
static void |
mapJavaBeanProperties(Object bean,
Properties beanProps,
boolean isStrict)
This method takes the properties found in the given beanProps to the bean using the property editor registered for the
property.
|
static String |
stripClass(Class<?> clazz) |
static String |
stripClass(String clazz) |
static String |
stripPackage(Class<?> clazz) |
static String |
stripPackage(String fqn) |
public static Class<?> findClass(String name) throws ClassNotFoundException
ClassNotFoundException
public static Class<?> findClass(String name, ClassLoader loader) throws ClassNotFoundException
ClassNotFoundException
public static boolean isNullHandlingEnabled()
PropertyEditor.setAsText(String)
method for non-primitive targets?public static boolean isNull(String value)
value
- the valuepublic static boolean isNull(String value, boolean trim, boolean empty)
value
- the valuetrim
- whether to trim the stringempty
- whether to include the empty string as nullpublic static Object convertValue(String text, String typeName) throws ClassNotFoundException, IntrospectionException
text
- the string represention of the value. This is passed to the PropertyEditor.setAsText method.typeName
- the fully qualified class name of the true value typeClassNotFoundException
- thrown if the typeName class cannot be foundIntrospectionException
- thrown if a PropertyEditor for typeName cannot be foundpublic static void mapJavaBeanProperties(Object bean, Properties beanProps) throws IntrospectionException
bean
- - the java bean instance to apply the properties tobeanProps
- - map of java bean property name to property value.IntrospectionException
- thrown on introspection of bean and if a property in beanProps does not map to a property
of bean.public static void mapJavaBeanProperties(Object bean, Properties beanProps, boolean isStrict) throws IntrospectionException
bean
- - the java bean instance to apply the properties tobeanProps
- - map of java bean property name to property value.isStrict
- - indicates if should throw exception if bean property can not be matched. True for yes, false for no.IntrospectionException
- thrown on introspection of bean and if a property in beanProps does not map to a property
of bean.Copyright © 2014 JBoss by Red Hat. All rights reserved.