Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.util.propertyeditor
Class PropertyEditors

    java.lang.Object
      org.jboss.util.propertyeditor.PropertyEditors

public class PropertyEditors
extends Object

A collection of PropertyEditor utilities. Provides the same interface as PropertyManagerEditor plus more...

Installs the default PropertyEditors.

Version:
  `$Revision: 1.6.6.4 $`
Author:
  Jason Dillon, Scott.Stark@jboss.org

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` | `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` | `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

### PropertyEditors

    public PropertyEditors()

Method Detail

### findEditor

    public static PropertyEditor findEditor(Class type)

  Locate a value editor for a given target type.

  Parameters:
    `type` - The class of the object to be edited.
  Returns:
    An editor for the given type or null if none was found.

### findEditor

    public static PropertyEditor findEditor(String typeName)
                                     throws ClassNotFoundException

  Locate a value editor for a given target type.

  Parameters:
    `typeName` - The class name of the object to be edited.
  Returns:
    An editor for the given type or null if none was found.
  Throws:
    `ClassNotFoundException`

### getEditor

    public static PropertyEditor getEditor(Class type)

  Get a value editor for a given target type.

  Parameters:
    `type` - The class of the object to be edited.
  Returns:
    An editor for the given type.
  Throws:
    `RuntimeException` - No editor was found.

### getEditor

    public static PropertyEditor getEditor(String typeName)
                                    throws ClassNotFoundException

  Get a value editor for a given target type.

  Parameters:
    `typeName` - The class name of the object to be edited.
  Returns:
    An editor for the given type.
  Throws:
    `RuntimeException` - No editor was found.
    `ClassNotFoundException`

### registerEditor

    public static void registerEditor(Class type,
                                      Class editorType)

  Register an editor class to be used to editor values of a given target class.

  Parameters:
    `type` - The class of the objetcs to be edited.
    `editorType` - The class of the editor.

### registerEditor

    public static void registerEditor(String typeName,
                                      String editorTypeName)
                               throws ClassNotFoundException

  Register an editor class to be used to editor values of a given target class.

  Parameters:
    `typeName` - The classname of the objetcs to be edited.
    `editorTypeName` - The class of the editor.
  Throws:
    `ClassNotFoundException`

### convertValue

    public static Object convertValue(String text,
                                      String typeName)
                               throws ClassNotFoundException,
                                      IntrospectionException

  Convert a string value into the true value for typeName using the PropertyEditor associated with typeName.

  Parameters:
    `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
  Returns:
    the PropertyEditor.getValue() result
  Throws:
    `ClassNotFoundException` - thrown if the typeName class cannot be found
    `IntrospectionException` - thrown if a PropertyEditor for typeName cannot be found

### mapJavaBeanProperties

    public static void mapJavaBeanProperties(Object bean,
                                             Properties beanProps)
                                      throws IntrospectionException

  This method takes the properties found in the given beanProps to the bean using the property editor registered for the property. Any property in beanProps that does not have an associated java bean property will result in an IntrospectionException. The string property values are converted to the true java bean property type using the java bean PropertyEditor framework. If a property in beanProps does not have a PropertyEditor registered it will be ignored.

  Parameters:
    `bean` - - the java bean instance to apply the properties to
    `beanProps` - - map of java bean property name to property value.
  Throws:
    `IntrospectionException` - thrown on introspection of bean and if a property in beanProps does not map to a property of bean.

### getEditorSearchPath

    public String[] getEditorSearchPath()

  Gets the package names that will be searched for property editors.

  Returns:
    The package names that will be searched for property editors.

### setEditorSearchPath

    public void setEditorSearchPath(String[] path)

  Sets the package names that will be searched for property editors.

  Parameters:
    `path` - The serach path.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.