/** * 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) */ 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()); }
/** * 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) */ 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()); }
/** * See {@link java.beans.FeatureDescriptor}. */ public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) { target.setExpert(source.isExpert()); target.setHidden(source.isHidden()); target.setPreferred(source.isPreferred()); target.setName(source.getName()); target.setShortDescription(source.getShortDescription()); target.setDisplayName(source.getDisplayName()); // Copy all attributes (emulating behavior of private FeatureDescriptor#addTable) Enumeration<String> keys = source.attributeNames(); while (keys.hasMoreElements()) { String key = keys.nextElement(); target.setValue(key, source.getValue(key)); } // See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor) target.setPropertyEditorClass(source.getPropertyEditorClass()); target.setBound(source.isBound()); target.setConstrained(source.isConstrained()); }
/** * See {@link java.beans.FeatureDescriptor}. */ public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) { target.setExpert(source.isExpert()); target.setHidden(source.isHidden()); target.setPreferred(source.isPreferred()); target.setName(source.getName()); target.setShortDescription(source.getShortDescription()); target.setDisplayName(source.getDisplayName()); // Copy all attributes (emulating behavior of private FeatureDescriptor#addTable) Enumeration<String> keys = source.attributeNames(); while (keys.hasMoreElements()) { String key = keys.nextElement(); target.setValue(key, source.getValue(key)); } // See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor) target.setPropertyEditorClass(source.getPropertyEditorClass()); target.setBound(source.isBound()); target.setConstrained(source.isConstrained()); }
public boolean isConstrained() { if( propertyDescriptor!=null ){ return propertyDescriptor.isConstrained(); } return constrained; }
@Override public boolean isConstrained() { return this.property.isConstrained(); }
/** * 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) */ 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()); }
builder.append(",").append("constrained=").append(descriptor.isConstrained());
protected void fillAttributes ( final PropertyDescriptor pd, final Map<String, Variant> attributes ) { attributes.put ( "property.writeable", Variant.valueOf ( pd.getWriteMethod () != null ) ); attributes.put ( "property.readable", Variant.valueOf ( pd.getReadMethod () != null ) ); attributes.put ( "property.bound", Variant.valueOf ( pd.isBound () ) ); attributes.put ( "property.expert", Variant.valueOf ( pd.isExpert () ) ); attributes.put ( "property.constrained", Variant.valueOf ( pd.isConstrained () ) ); attributes.put ( "property.label", Variant.valueOf ( pd.getDisplayName () ) ); attributes.put ( "property.type", Variant.valueOf ( pd.getPropertyType ().getName () ) ); attributes.put ( "property.name", Variant.valueOf ( pd.getName () ) ); attributes.put ( "description", Variant.valueOf ( pd.getShortDescription () ) ); }
/** * Compare the given {@link PropertyDescriptor} against the given {@link Object} and * return {@code true} if they are objects are equivalent, i.e. both are {@code * PropertyDescriptor}s whose read method, write method, property types, property * editor and flags are equivalent. * * @see PropertyDescriptor#equals(Object) */ public static boolean equals(PropertyDescriptor pd1, Object obj) { if (pd1 == obj) { return true; } if (obj != null && obj instanceof PropertyDescriptor) { PropertyDescriptor pd2 = (PropertyDescriptor) obj; if (!compareMethods(pd1.getReadMethod(), pd2.getReadMethod())) { return false; } if (!compareMethods(pd1.getWriteMethod(), pd2.getWriteMethod())) { return false; } if (pd1.getPropertyType() == pd2.getPropertyType() && pd1.getPropertyEditorClass() == pd2.getPropertyEditorClass() && pd1.isBound() == pd2.isBound() && pd1.isConstrained() == pd2.isConstrained()) { return true; } } return false; }
/** * Compare the given {@link PropertyDescriptor} against the given {@link Object} and * return {@code true} if they are objects are equivalent, i.e. both are {@code * PropertyDescriptor}s whose read method, write method, property types, property * editor and flags are equivalent. * * @see PropertyDescriptor#equals(Object) */ public static boolean equals(PropertyDescriptor pd1, Object obj) { if (pd1 == obj) { return true; } if (obj != null && obj instanceof PropertyDescriptor) { PropertyDescriptor pd2 = (PropertyDescriptor) obj; if (!compareMethods(pd1.getReadMethod(), pd2.getReadMethod())) { return false; } if (!compareMethods(pd1.getWriteMethod(), pd2.getWriteMethod())) { return false; } if (pd1.getPropertyType() == pd2.getPropertyType() && pd1.getPropertyEditorClass() == pd2.getPropertyEditorClass() && pd1.isBound() == pd2.isBound() && pd1.isConstrained() == pd2.isConstrained()) { return true; } } return false; }
System.out.println (" - constrained: " + pd[i].isConstrained());
pi.setConstrained(pd.isConstrained()); pi.setDescription(pd.getShortDescription()); pi.setNullable(true);
/** * Create a {@link MetaProperty} from the specified {@link PropertyDescriptor}. * * @param pd * @param existing * @return MetaProperty */ protected MetaProperty buildMetaProperty(PropertyDescriptor pd, MetaProperty existing) { MetaProperty meta = new MetaProperty(); meta.setName(pd.getName()); meta.setType(determineGenericPropertyType(pd)); if (pd.isHidden()) { meta.putFeature(HIDDEN, Boolean.TRUE); } if (pd.isPreferred()) { meta.putFeature(PREFERRED, Boolean.TRUE); } if (pd.isConstrained()) { meta.putFeature(READONLY, Boolean.TRUE); } Enumeration<String> enumeration = pd.attributeNames(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); Object value = pd.getValue(key); meta.putFeature(key, value); } return meta; }
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) throws IntrospectionException { target.setExpert(source.isExpert()); target.setHidden(source.isHidden()); target.setPreferred(source.isPreferred()); target.setName(source.getName()); target.setShortDescription(source.getShortDescription()); target.setDisplayName(source.getDisplayName()); // Copy all attributes (emulating behavior of private FeatureDescriptor#addTable) Enumeration<String> keys = source.attributeNames(); while (keys.hasMoreElements()) { String key = keys.nextElement(); target.setValue(key, source.getValue(key)); } // See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor) target.setPropertyEditorClass(source.getPropertyEditorClass()); target.setBound(source.isBound()); target.setConstrained(source.isConstrained()); }
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) throws IntrospectionException { target.setExpert(source.isExpert()); target.setHidden(source.isHidden()); target.setPreferred(source.isPreferred()); target.setName(source.getName()); target.setShortDescription(source.getShortDescription()); target.setDisplayName(source.getDisplayName()); // Copy all attributes (emulating behavior of private FeatureDescriptor#addTable) Enumeration<String> keys = source.attributeNames(); while (keys.hasMoreElements()) { String key = keys.nextElement(); target.setValue(key, source.getValue(key)); } // See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor) target.setPropertyEditorClass(source.getPropertyEditorClass()); target.setBound(source.isBound()); target.setConstrained(source.isConstrained()); }
/** * See {@link java.beans.FeatureDescriptor}. */ public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) throws IntrospectionException { target.setExpert(source.isExpert()); target.setHidden(source.isHidden()); target.setPreferred(source.isPreferred()); target.setName(source.getName()); target.setShortDescription(source.getShortDescription()); target.setDisplayName(source.getDisplayName()); // Copy all attributes (emulating behavior of private FeatureDescriptor#addTable) Enumeration<String> keys = source.attributeNames(); while (keys.hasMoreElements()) { String key = keys.nextElement(); target.setValue(key, source.getValue(key)); } // See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor) target.setPropertyEditorClass(source.getPropertyEditorClass()); target.setBound(source.isBound()); target.setConstrained(source.isConstrained()); }