/
UnkeyedModelInterfaceGeneratorProcessor.cs
49 lines (42 loc) · 1.7 KB
/
UnkeyedModelInterfaceGeneratorProcessor.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
// Copyright (c) 2020 DHGMS Solutions and Contributors. All rights reserved.
// DHGMS Solutions and Contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
using System.Linq;
using Dhgms.Nucleotide.Generators.GeneratorProcessors;
using Dhgms.Nucleotide.Generators.Models;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Dhgms.Nucleotide.Generators.Features.Model
{
public sealed class UnkeyedModelInterfaceGeneratorProcessor : BaseInterfaceLevelCodeGeneratorProcessor<IEntityGenerationModel>
{
protected override string GetClassSuffix()
{
return "Model";
}
protected override string[] GetInterfaceSummary(IEntityGenerationModel entityDeclaration)
{
return new[]
{
$"Unkeyed Model Interface for {entityDeclaration.ClassName}"
};
}
protected override string[] GetClassPrefixes()
{
return new[] { "Unkeyed"};
}
protected override PropertyDeclarationSyntax[] GetPropertyDeclarations(
IEntityGenerationModel entityGenerationModel, string prefix)
{
return entityGenerationModel.Properties?.Select(GetPropertyDeclaration).ToArray();
}
protected override MethodDeclarationSyntax[] GetMethodDeclarations(string className, string prefix)
{
return null;
}
protected override string[] GetBaseInterfaces(IEntityGenerationModel entityGenerationModel, string prefix)
{
return entityGenerationModel.InterfaceGenerationModels?.Select(x => x.ClassName)
.ToArray();
}
}
}