namespace Umbraco.Core.Configuration
{
///
/// This is used to supply optional/default values when using InnerTextConfigurationElement
///
///
internal class OptionalInnerTextConfigurationElement : InnerTextConfigurationElement
{
private readonly InnerTextConfigurationElement _wrapped;
private readonly T _defaultValue;
public OptionalInnerTextConfigurationElement(InnerTextConfigurationElement wrapped, T defaultValue)
{
_wrapped = wrapped;
_defaultValue = defaultValue;
}
public override T Value
{
get { return string.IsNullOrEmpty(_wrapped.RawValue) ? _defaultValue : _wrapped.Value; }
}
}
}