|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.util.propertyeditor.PropertyEditors
public class PropertyEditors
A collection of PropertyEditor utilities. Provides the same interface as PropertyEditorManager plus more...
Installs the default PropertyEditors.
Constructor Summary | |
---|---|
PropertyEditors()
|
Method Summary | |
---|---|
static Object |
convertValue(String text,
String typeName)
Convert a string value into the true value for typeName using the PropertyEditor associated with typeName. |
static PropertyEditor |
findEditor(Class type)
Locate a value editor for a given target type. |
static PropertyEditor |
findEditor(String typeName)
Locate a value editor for a given target type. |
static PropertyEditor |
getEditor(Class type)
Get a value editor for a given target type. |
static PropertyEditor |
getEditor(String typeName)
Get a value editor for a given target type. |
String[] |
getEditorSearchPath()
Gets the package names that will be searched for property editors. |
static void |
init()
Augment the PropertyEditorManager search path to incorporate the JBoss specific editors by appending the org.jboss.util.propertyeditor package to the PropertyEditorManager editor search path. |
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 void |
registerEditor(Class type,
Class editorType)
Register an editor class to be used to editor values of a given target class. |
static void |
registerEditor(String typeName,
String editorTypeName)
Register an editor class to be used to editor values of a given target class. |
void |
setEditorSearchPath(String[] path)
Sets the package names that will be searched for property editors. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertyEditors()
Method Detail |
---|
public static void init()
public static final boolean isNull(String value)
value
- the value
public static final boolean isNull(String value, boolean trim, boolean empty)
value
- the valuetrim
- whether to trim the stringempty
- whether to include the empty string as null
public static boolean isNullHandlingEnabled()
PropertyEditor.setAsText(String)
method for non-primitive targets?
public static PropertyEditor findEditor(Class type)
type
- The class of the object to be edited.
public static PropertyEditor findEditor(String typeName) throws ClassNotFoundException
typeName
- The class name of the object to be edited.
ClassNotFoundException
public static PropertyEditor getEditor(Class type)
type
- The class of the object to be edited.
RuntimeException
- No editor was found.public static PropertyEditor getEditor(String typeName) throws ClassNotFoundException
typeName
- The class name of the object to be edited.
RuntimeException
- No editor was found.
ClassNotFoundException
public static void registerEditor(Class type, Class editorType)
type
- The class of the objetcs to be edited.editorType
- The class of the editor.public static void registerEditor(String typeName, String editorTypeName) throws ClassNotFoundException
typeName
- The classname of the objetcs to be edited.editorTypeName
- The class of the editor.
ClassNotFoundException
public 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 type
ClassNotFoundException
- thrown if the typeName class cannot
be found
IntrospectionException
- 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.public String[] getEditorSearchPath()
public void setEditorSearchPath(String[] path)
path
- The serach path.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |