Java Code Examples for java.beans.PropertyDescriptor#createPropertyEditor()

The following examples show how to use java.beans.PropertyDescriptor#createPropertyEditor() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gflogger   File: BeanUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static void setPropertyStringValue(
	final Object bean,
	final PropertyDescriptor property,
	final String value
) throws Exception {
	final PropertyEditor editor = property.createPropertyEditor( bean );
	if ( editor != null ) {
		editor.setAsText( value );
	} else {
		final Method writeMethod = property.getWriteMethod();
		if ( writeMethod != null ) {
			final Class paramClass = writeMethod.getParameterTypes()[0];
			try {
				final Object aValue = convert( value, paramClass );
				if ( aValue != null ) {
					writeMethod.invoke( bean, aValue );
				}
			} catch ( Exception e ) {
				//just skip
			}
		}
	}
}
 
Example 2
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 3
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 4
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 5
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 6
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 7
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 8
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 9
Source Project: hottub   File: Test7087876.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 10
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 11
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 12
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 13
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}
 
Example 14
public static void main(String[] args) throws IntrospectionException {
    PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
    pd.setPropertyEditorClass(Editor.class);
    pd.createPropertyEditor(new Bean());
}