Example usage for java.beans PropertyDescriptor setWriteMethod

List of usage examples for java.beans PropertyDescriptor setWriteMethod

Introduction

In this page you can find the example usage for java.beans PropertyDescriptor setWriteMethod.

Prototype

public synchronized void setWriteMethod(Method writeMethod) throws IntrospectionException 

Source Link

Document

Sets the method that should be used to write the property value.

Usage

From source file:org.wings.STransferHandler.java

private static PropertyDescriptor getPropertyDescriptor(String propertyName, Class<?> componentClass) {
    PropertyDescriptor descriptor = new PropertyDescriptor();

    Method[] methods = componentClass.getMethods();
    for (Method method : methods) {
        if (method.getName().equalsIgnoreCase("get" + propertyName)) {
            descriptor.setReadMethod(method);
            continue;
        }//from w  w  w. j av  a2  s.  co  m

        if (method.getName().equalsIgnoreCase("set" + propertyName)) {
            descriptor.setWriteMethod(method);
            continue;
        }
    }

    return descriptor;
}