Skip to content

Commit

Permalink
Rename classes
Browse files Browse the repository at this point in the history
  • Loading branch information
inputfalken committed Jun 14, 2024
1 parent c203ade commit 5354c0f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/DynamoDBGenerator.SourceGenerator/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static class ConversionStrategy
}

public const string AssemblyName = "DynamoDBGenerator";
public const string DynamoDbDocumentPropertyFullname = $"{Namespace.AttributesFullName}.{Attribute.DynamoDBMarshaller}";
public const string DynamoDBMarshallerFullname = $"{Namespace.AttributesFullName}.{Attribute.DynamoDBMarshaller}";

public const string DynamoDBConverterFullName = $"{AssemblyName}.{Namespace.Options}.{Converter.AttributeValueConverters}";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace DynamoDBGenerator.SourceGenerator;

[Generator]
// ReSharper disable once InconsistentNaming
public class DynamoDBDMarshallerEntry : IIncrementalGenerator
public class DynamoDBDMarshaller : IIncrementalGenerator
{
public void Initialize(IncrementalGeneratorInitializationContext context)
{
var updateClassDeclarations = context.SyntaxProvider
.ForAttributeWithMetadataName(
Constants.DynamoDBGenerator.DynamoDbDocumentPropertyFullname,
Constants.DynamoDBGenerator.DynamoDBMarshallerFullname,
(n, _) => n is ClassDeclarationSyntax or RecordDeclarationSyntax or StructDeclarationSyntax,
(c, _) => c.TargetNode
);
Expand Down Expand Up @@ -74,12 +74,11 @@ private static IEnumerable<string> CreateFileContent(INamedTypeSymbol type, Comp
throw new NotImplementedException(
$"Generate accessibility of '{type.DeclaredAccessibility}' on '{type.ToDisplayParts()}' only '{type.DeclaredAccessibility == Accessibility.Public}' is supported."
);
var @static = type.IsStatic ? "static " : null;


var (options, args) = CreateArguments(type, compilation);
var classContent =
$"public {@static}{typeType} {type.Name}".CreateScope(DynamoDbMarshaller.CreateRepository(args, options));
var classContent = $"public {(type.IsStatic ? "static " : null)}{typeType} {type.Name}"
.CreateScope(MarshallerFactory.CreateRepository(args, options));

var content = type.ContainingNamespace.IsGlobalNamespace
? classContent
: $"namespace {type.ContainingNamespace.ToDisplayString()}".CreateScope(classContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using static DynamoDBGenerator.SourceGenerator.Constants.DynamoDBGenerator.Marshaller;
namespace DynamoDBGenerator.SourceGenerator;

public static class DynamoDbMarshaller
public static class MarshallerFactory
{
private static IEnumerable<string> CreateImplementations(IEnumerable<DynamoDBMarshallerArguments> arguments,
MarshallerOptions options)
Expand Down

0 comments on commit 5354c0f

Please sign in to comment.