Skip to content

Commit

Permalink
renamed attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
j0nimost committed Oct 6, 2023
1 parent bbfd1e4 commit 9cdea7b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ Example:
```c#
class CSVDataWithAttributes
{
[Kafa("date")]
[KafaColumn("date")]
public DateTime Date { get; set; }
[Kafa(1)]
[KafaColumn(1)]
public double Open { get; set; }
[Kafa(2)]
[KafaColumn(2)]
public double High { get; set; }
[Kafa(3)]
[KafaColumn(3)]
public double Low { get; set; }
[Kafa(4)]
[KafaColumn(4)]
public double Close { get; set; }
[Kafa(5)]
[KafaColumn(5)]
public int Volume { get; set; }
[Kafa("name")]
[KafaColumn("name")]
public string Name { get; set; }
}
```
Expand Down
6 changes: 3 additions & 3 deletions src/Kafa/KafaAttribute.cs → src/Kafa/KafaColumnAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
namespace nyingi.Kafa
{
[System.AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple =false)]
public class KafaAttribute : Attribute
public class KafaColumnAttribute : Attribute
{
public readonly string FieldName;
public readonly int FieldIndex;
/// <summary>
/// Name of the Column to be matched with
/// </summary>
/// <param name="fieldName"></param>
public KafaAttribute(string fieldName)
public KafaColumnAttribute(string fieldName)
{
FieldName = fieldName;
}
Expand All @@ -23,7 +23,7 @@ public KafaAttribute(string fieldName)
/// Index of the Column starting from 0 to N-1
/// </summary>
/// <param name="index"></param>
public KafaAttribute(int index)
public KafaColumnAttribute(int index)
{
FieldIndex = index;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kafa/Reflection/KafaReflection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public KafaReflection(KafaTypeInfo typeInfo, OrderedDictionary Headers = default
{
if(Headers != null)
{
var kafa = property.GetCustomAttribute<KafaAttribute>(false);
var kafa = property.GetCustomAttribute<KafaColumnAttribute>(false);

if (kafa != null)
{
Expand Down
14 changes: 7 additions & 7 deletions src/KafaTests/KafaReadToTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ class CsvData

class CSVDataWithAttributes
{
[Kafa("date")]
[KafaColumn("date")]
public DateTime Date { get; set; }
[Kafa(1)]
[KafaColumn(1)]
public double Open { get; set; }
[Kafa(2)]
[KafaColumn(2)]
public double High { get; set; }
[Kafa(3)]
[KafaColumn(3)]
public double Low { get; set; }
[Kafa(4)]
[KafaColumn(4)]
public double Close { get; set; }
[Kafa(5)]
[KafaColumn(5)]
public int Volume { get; set; }
[Kafa("name")]
[KafaColumn("name")]
public string Name { get; set; }
}
public class KafaReadToTypeTests
Expand Down

0 comments on commit 9cdea7b

Please sign in to comment.