Skip to content

Commit

Permalink
Fixing doc about interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-iel committed Apr 30, 2024
1 parent 0d654ce commit 578411e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 116 deletions.
37 changes: 0 additions & 37 deletions app/Spinner/Internals/Cache/TypeParserCache.cs

This file was deleted.

44 changes: 0 additions & 44 deletions app/Spinner/Internals/Extensions/SpanExtensions.cs

This file was deleted.

30 changes: 0 additions & 30 deletions app/Spinner/Internals/Guards/Guard.cs

This file was deleted.

10 changes: 5 additions & 5 deletions docs/docs/mapping-string-into-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
sidebar_position: 4
---

# Type Parser
# Interceptor

If you require extracting positional strings and converting the values into their final forms, such as obtaining a string representing a datetime or decimal currency format, you can create an interceptor reader by implementing the `ITypeParser` interface. This allows you to perform custom actions before the value is set to the final property.
If you require extracting positional strings and converting the values into their final forms, such as obtaining a string representing a datetime or decimal currency format, you can create an interceptor reader by implementing the `IInterceptor` interface. This allows you to perform custom actions before the value is set to the final property.

here and example of intercept the property read.

```csharp

public class ParserWebSite : ITypeParser
public class WebSiteInterceptor : IInterceptor
{
public object Parser(object propertyValue)
public object Parse(object propertyValue)
{
return $"WebSite: {propertyValue.ToString()}";
}
}

[ReadProperty(start: 9, length: 20, type: typeof(ParserWebSite))]
[ReadProperty(start: 9, length: 20, type: typeof(WebSiteInterceptor))]

```

0 comments on commit 578411e

Please sign in to comment.