using System;
namespace Artemis.Core.Modules;
///
/// Represents a dynamic child value with its property attribute
///
public class DynamicChild : DynamicChild
{
internal DynamicChild(T value, string key, DataModelPropertyAttribute attribute) : base(key, attribute, typeof(T))
{
Value = value;
}
///
/// Gets or sets the current value of the dynamic child
///
public T Value { get; set; }
///
protected override object? GetValue()
{
return Value;
}
}
///
/// Represents a dynamic child value with its property attribute
///
public abstract class DynamicChild
{
internal DynamicChild(string key, DataModelPropertyAttribute attribute, Type type)
{
if (type == null) throw new ArgumentNullException(nameof(type));
Key = key ?? throw new ArgumentNullException(nameof(key));
Attribute = attribute ?? throw new ArgumentNullException(nameof(attribute));
Type = type;
}
///
/// Gets the key of the dynamic child
///
public string Key { get; }
///
/// Gets the attribute describing the dynamic child
///
public DataModelPropertyAttribute Attribute { get; }
///
/// Gets the type of
///
public Type Type { get; }
///
/// Gets the current value of the dynamic child
///
public object? BaseValue => GetValue();
///
/// Gets the current value of the dynamic child
///
/// The current value of the dynamic child
protected abstract object? GetValue();
}