Obsolete HasValue method

This commit is contained in:
Ronald Barendse
2020-06-11 00:45:12 +02:00
parent 1d6849c578
commit c3e58df3b5
@@ -16,7 +16,9 @@ namespace Umbraco.Core.PropertyEditors
switch (level)
{
case PropertyValueLevel.Source:
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
// the default implementation uses the old magic null & string comparisons,
// other implementations may be more clever, and/or test the final converted object values
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string)value) == false);
case PropertyValueLevel.Inter:
return null;
case PropertyValueLevel.Object:
@@ -26,16 +28,15 @@ namespace Umbraco.Core.PropertyEditors
}
}
[Obsolete("This method is not part of the IPropertyValueConverter contract and therefore not used, use IsValue instead.")]
public virtual bool HasValue(IPublishedProperty property, string culture, string segment)
{
// the default implementation uses the old magic null & string comparisons,
// other implementations may be more clever, and/or test the final converted object values
var value = property.GetSourceValue(culture, segment);
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string)value) == false);
}
public virtual Type GetPropertyValueType(IPublishedPropertyType propertyType)
=> typeof (object);
=> typeof(object);
public virtual PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
=> PropertyCacheLevel.Snapshot;