public void run() { for (String propertyName : propertyNames) { PropertyDescriptor propertyDescriptor = component.get().getComponentDescriptor().getPropertyDescriptor(propertyName); if (!(propertyDescriptor.getDefaultValue().getKind() != PropertyValue.Kind.NULL || propertyDescriptor.isAllowNull())) { supportsDefaultValue[0] = false; break; } } } });
/** * Returns whether the property value is compatible with a specified property descriptor. * @param propertyDescriptor the property descriptor * @return true, if the property value is allowed for the property descriptor */ public boolean isCompatible(PropertyDescriptor propertyDescriptor) { if (propertyDescriptor == null) { return false; } if (kind == Kind.NULL) { if (!propertyDescriptor.isAllowNull()) { PropertyValue defaultValue = propertyDescriptor.getDefaultValue(); if (defaultValue == null || defaultValue.getKind() != PropertyValue.Kind.NULL) { // HACK for PropertyDescriptor for disallowing to use null values return false; } } } else if (kind == Kind.USERCODE) { if (!propertyDescriptor.isAllowUserCode()) { return false; } } return isCompatible(propertyDescriptor.getType()); }
if (userCode != null) setAttribute (document, propertyNode, XMLComponentDescriptor.DEFAULT_VALUE_ATTR, userCode); setAttribute (document, propertyNode, XMLComponentDescriptor.ALLOW_NULL, Boolean.toString (propertyDescriptor.isAllowNull ())); setAttribute (document, propertyNode, XMLComponentDescriptor.ALLOW_USER_CODE, Boolean.toString (propertyDescriptor.isAllowUserCode ())); setAttribute (document, propertyNode, XMLComponentDescriptor.USE_FOR_SERIALIZATION_ATTR, Boolean.toString (propertyDescriptor.isUseForSerialization ()));