JD2022-TU1/main/tools/framework/JD.TeaBoxAddinSystem/Addins/Attributes/NodeAttributeAttribute.cs

72 lines
2.3 KiB
C#

using System;
namespace JD.TeaBoxAddinSystem.Addins.Attributes
{
/// <summary>
/// Attribute used to serialize <see cref="ExtensionNode"/>s and <see cref="ConditionNode"/>s automatically.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public class NodeAttributeAttribute : StringPropertyConverterAttribute
{
#region Constructor
/// <summary>
/// Constructor.
/// </summary>
public NodeAttributeAttribute()
: this(string.Empty, false, string.Empty)
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="name">Name of the attribute.</param>
public NodeAttributeAttribute(string name)
: this(name, false, string.Empty)
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="required">Whether this attribute is required.</param>
public NodeAttributeAttribute(bool required)
: this(string.Empty, required, string.Empty)
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="name">Name of the attribute.</param>
/// <param name="required">Whether this attribute is required.</param>
public NodeAttributeAttribute(string name, bool required)
: this(name, required, string.Empty)
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="name">Name of the attribute.</param>
/// <param name="description">Optional description of the attribute.</param>
public NodeAttributeAttribute(string name, string description)
: this(name, false, description)
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="name">Name of the attribute.</param>
/// <param name="required">Whether this attribute is required.</param>
/// <param name="description">Optional description of the attribute.</param>
public NodeAttributeAttribute(string name, bool required, string description)
: base(name, required, description)
{
}
#endregion
}
}