Files
quantconnect--lean/Common/DocumentationAttribute.cs
T
Martin-Molinero 26f2f88c67
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Add documentation attribute default value (#6095)
2021-12-03 18:47:47 -03:00

55 lines
1.7 KiB
C#

/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using Newtonsoft.Json;
namespace QuantConnect
{
/// <summary>
/// Custom attribute used for documentation
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public sealed class DocumentationAttribute : Attribute
{
/// <summary>
/// The documentation tag
/// </summary>
[JsonProperty(PropertyName = "tag")]
public string Tag { get; }
/// <summary>
/// The associated weight of this attribute and tag
/// </summary>
[JsonProperty(PropertyName = "weight")]
public int Weight { get; }
/// <summary>
/// The attributes type id, we override it to ignore it when serializing
/// </summary>
[JsonIgnore]
public override object TypeId => base.TypeId;
/// <summary>
/// Creates a new instance
/// </summary>
public DocumentationAttribute(string tag, int weight = 0)
{
Tag = tag;
Weight = weight;
}
}
}