-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomJPropertyAttribute.cs
66 lines (59 loc) · 2.14 KB
/
CustomJPropertyAttribute.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;
using System.Text;
namespace Berry.Serialization
{
/// <summary>
/// Instructs the serialize name and ability.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public sealed class CustomJPropertyAttribute : Attribute
{
#region Constructor
/// <summary>
/// Initializes a new instance of the Berry.Serialization.CustomJPropertyAttribute class.
/// </summary>
public CustomJPropertyAttribute()
{
Serializable = true;
Deserializable = true;
}
/// <summary>
/// Initializes a new instance of the Berry.Serialization.CustomJPropertyAttribute class
/// with the specified name.
/// </summary>
/// <param name="propertyName"></param>
public CustomJPropertyAttribute(string propertyName)
{
Serializable = true;
Deserializable = true;
Name = propertyName;
}
#endregion
#region Public Properties
/// <summary>
/// Gets or sets a value indicating whether serialize the property.
/// The default value is true.
/// </summary>
public bool Serializable { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether deserialize the property .
/// The default value is true.
/// </summary>
public bool Deserializable { get; set; } = true;
/// <summary>
/// Gets or sets the name of the property when serializing.
/// </summary>
public string SerializeName { get; set; }
/// <summary>
/// Gets or sets the name of the property when deserializing.
/// </summary>
public string DeserializeName { get; set; }
/// <summary>
/// Gets or sets the name of the property when serializing or deserializing.
/// The priority is lower than <see cref="SerializeName"/> and <see cref="DeserializeName"/>.
/// </summary>
public string Name { get; set; }
#endregion
}
}