Example usage for java.beans PropertyDescriptor isConstrained

List of usage examples for java.beans PropertyDescriptor isConstrained

Introduction

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

Prototype

public boolean isConstrained() 

Source Link

Document

Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.

Usage

From source file:com.twinsoft.convertigo.beans.core.MySimpleBeanInfo.java

protected PropertyDescriptor getPropertyDescriptor(String name) throws IntrospectionException {
    checkAdditionalProperties();/*from w  w  w  .  j a  va 2s  .c  o m*/
    for (int i = 0; i < properties.length; i++) {
        PropertyDescriptor property = properties[i];
        if (name.equals(property.getName())) {
            PropertyDescriptor clone = new PropertyDescriptor(name, property.getReadMethod(),
                    property.getWriteMethod());
            clone.setDisplayName(property.getDisplayName());
            clone.setShortDescription(property.getShortDescription());
            clone.setPropertyEditorClass(property.getPropertyEditorClass());
            clone.setBound(property.isBound());
            clone.setConstrained(property.isConstrained());
            clone.setExpert(property.isExpert());
            clone.setHidden(property.isHidden());
            clone.setPreferred(property.isPreferred());
            for (String attributeName : Collections.list(property.attributeNames())) {
                clone.setValue(attributeName, property.getValue(attributeName));
            }
            return properties[i] = clone;
        }
    }
    return null;
}

From source file:org.grails.beans.support.CachedIntrospectionResults.java

/**
 * Compare the given {@code PropertyDescriptors} and return {@code true} if
 * they are equivalent, i.e. their read method, write method, property type,
 * property editor and flags are equivalent.
 * @see java.beans.PropertyDescriptor#equals(Object)
 *//*from   www .  j a  va 2 s  .  c  om*/
public static boolean equals(PropertyDescriptor pd, PropertyDescriptor otherPd) {
    return (ObjectUtils.nullSafeEquals(pd.getReadMethod(), otherPd.getReadMethod())
            && ObjectUtils.nullSafeEquals(pd.getWriteMethod(), otherPd.getWriteMethod())
            && ObjectUtils.nullSafeEquals(pd.getPropertyType(), otherPd.getPropertyType())
            && ObjectUtils.nullSafeEquals(pd.getPropertyEditorClass(), otherPd.getPropertyEditorClass())
            && pd.isBound() == otherPd.isBound() && pd.isConstrained() == otherPd.isConstrained());
}