-
-
Notifications
You must be signed in to change notification settings - Fork 147
/
ExclusiveMaximumIntent.cs
51 lines (47 loc) · 1.4 KB
/
ExclusiveMaximumIntent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
namespace Json.Schema.Generation.Intents
{
/// <summary>
/// Provides intent to create an `exclusiveMaximum` keyword.
/// </summary>
public class ExclusiveMaximumIntent : ISchemaKeywordIntent
{
/// <summary>
/// The value.
/// </summary>
public decimal Value { get; }
/// <summary>
/// Creates a new <see cref="ExclusiveMaximumIntent"/> instance.
/// </summary>
/// <param name="value">The value.</param>
public ExclusiveMaximumIntent(decimal value)
{
Value = value;
}
/// <summary>
/// Applies the keyword to the <see cref="JsonSchemaBuilder"/>.
/// </summary>
/// <param name="builder">The builder.</param>
public void Apply(JsonSchemaBuilder builder)
{
builder.ExclusiveMaximum(Value);
}
/// <summary>Determines whether the specified object is equal to the current object.</summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
public override bool Equals(object obj)
{
return !ReferenceEquals(null, obj);
}
/// <summary>Serves as the default hash function.</summary>
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
hashCode = (hashCode * 397) ^ Value.GetHashCode();
return hashCode;
}
}
}
}