Merge lp:~mandel/wadlsharp/remove_redundancy into lp:wadlsharp

Proposed by Manuel de la Peña on 2010-09-22
Status: Merged
Merge reported by: Manuel de la Peña
Merged at revision: not available
Proposed branch: lp:~mandel/wadlsharp/remove_redundancy
Merge into: lp:wadlsharp
Prerequisite: lp:~mandel/wadlsharp/add_diff_files
Diff against target: 84 lines (+19/-11)
3 files modified
LpNet.WadlSharp.Common/Generator/LpMethod.cs (+16/-11)
LpNet.WadlSharp.Common/LpNet.WadlSharp.Common.csproj (+2/-0)
LpNet.WadlSharp.UnitTest/LpNet.WadlSharp.UnitTest.csproj (+1/-0)
To merge this branch: bzr merge lp:~mandel/wadlsharp/remove_redundancy
Reviewer Review Type Date Requested Status
Manish Sinha (मनीष सिन्हा) 2010-09-22 Approve on 2010-09-28
Review via email: mp+36285@code.launchpad.net

This proposal supersedes a proposal from 2010-09-22.

Description of the change

Fixes lp:641441 by using a factory that will remove the redundancy when possible.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'LpNet.WadlSharp.Common/Generator/LpMethod.cs'
2--- LpNet.WadlSharp.Common/Generator/LpMethod.cs 2010-09-20 10:38:50 +0000
3+++ LpNet.WadlSharp.Common/Generator/LpMethod.cs 2010-09-22 11:11:05 +0000
4@@ -62,20 +62,28 @@
5 public LpMethod(Func<string, string> createIdentifier)
6 {
7 _createIdentifier = createIdentifier;
8+ CodeMemberFactory = new LpCodeMemberFactory(_createIdentifier) {RemoveRedundancyIfPossible = true};
9 }
10
11 #endregion
12
13+ #region DI properties
14+
15+ /// <summary>
16+ /// Gets and sets the code member factory used to generate the class members.
17+ /// </summary>
18+ public ICodeMemberFactory CodeMemberFactory { get; set; }
19+
20+ #endregion
21+
22 #region Public Methods Exposed by Interface
23
24- public CodeMemberMethod Create(method methodInstance, HashSet<string> nameSpaces, CodeNamespace ns, CodeTypeDeclaration typeDeclaration)
25+ public CodeMemberMethod Create(method methodInstance, HashSet<string> nameSpaces,
26+ CodeNamespace ns, CodeTypeDeclaration typeDeclaration)
27 {
28 // Create am instance of CodeMemberMethod and set it's name
29- CodeMemberMethod memberMethod = new CodeMemberMethod
30- {
31- Name = _createIdentifier(methodInstance.id),
32- Attributes = MemberAttributes.Public | MemberAttributes.Final
33- };
34+ var memberMethod = CodeMemberFactory.CreateCodeMember(methodInstance.id,
35+ typeDeclaration);
36
37 typeDeclarationField = typeDeclaration;
38
39@@ -142,11 +150,8 @@
40 if (paramSet != null)
41 {
42 // Create am instance of CodeMemberMethod and set it's name
43- CodeMemberMethod memberMethod = new CodeMemberMethod
44- {
45- Name = _createIdentifier(methodInstance.id),
46- Attributes = MemberAttributes.Public | MemberAttributes.Final
47- };
48+ var memberMethod = CodeMemberFactory.CreateCodeMember(methodInstance.id,
49+ typeDeclaration);
50
51 typeDeclarationField = typeDeclaration;
52
53
54=== modified file 'LpNet.WadlSharp.Common/LpNet.WadlSharp.Common.csproj'
55--- LpNet.WadlSharp.Common/LpNet.WadlSharp.Common.csproj 2010-09-22 11:11:05 +0000
56+++ LpNet.WadlSharp.Common/LpNet.WadlSharp.Common.csproj 2010-09-22 11:11:05 +0000
57@@ -50,6 +50,7 @@
58 <Compile Include="Enum\HttpMethod.cs" />
59 <Compile Include="Enum\LanguageConstructType.cs" />
60 <Compile Include="Generator\LpClassFactory.cs" />
61+ <Compile Include="Generator\LpCodeMemberFactory.cs" />
62 <Compile Include="Interface\Generator\IClassFactory.cs" />
63 <Compile Include="Generator\LpClass.cs" />
64 <Compile Include="Generator\LpComment.cs" />
65@@ -67,6 +68,7 @@
66 <DependentUpon>IdentifierNames.resx</DependentUpon>
67 </Compile>
68 <Compile Include="Interface\Generator\IClass.cs" />
69+ <Compile Include="Interface\Generator\ICodeMemberFactory.cs" />
70 <Compile Include="Interface\Generator\IComment.cs" />
71 <Compile Include="Interface\Generator\IConstructor.cs" />
72 <Compile Include="Interface\Generator\IEnum.cs" />
73
74=== modified file 'LpNet.WadlSharp.UnitTest/LpNet.WadlSharp.UnitTest.csproj'
75--- LpNet.WadlSharp.UnitTest/LpNet.WadlSharp.UnitTest.csproj 2010-09-22 11:11:05 +0000
76+++ LpNet.WadlSharp.UnitTest/LpNet.WadlSharp.UnitTest.csproj 2010-09-22 11:11:05 +0000
77@@ -54,6 +54,7 @@
78 </ItemGroup>
79 <ItemGroup>
80 <Compile Include="Generator\LpClassFactoryFixture.cs" />
81+ <Compile Include="Generator\LpCodeMemberFactoryFixture.cs" />
82 <Compile Include="Generator\LpNamespaceFixture.cs" />
83 <Compile Include="Serialize\MultiFileCodeSerializerFixture.cs" />
84 <Compile Include="Serialize\SingleFileCodeSerializerFixture.cs" />

Subscribers

People subscribed via source and target branches