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

Proposed by Manuel de la Peña
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 (मनीष सिन्हा) Approve
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.
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'LpNet.WadlSharp.Common/Generator/LpMethod.cs'
--- LpNet.WadlSharp.Common/Generator/LpMethod.cs 2010-09-20 10:38:50 +0000
+++ LpNet.WadlSharp.Common/Generator/LpMethod.cs 2010-09-22 11:11:05 +0000
@@ -62,20 +62,28 @@
62 public LpMethod(Func<string, string> createIdentifier)62 public LpMethod(Func<string, string> createIdentifier)
63 {63 {
64 _createIdentifier = createIdentifier;64 _createIdentifier = createIdentifier;
65 CodeMemberFactory = new LpCodeMemberFactory(_createIdentifier) {RemoveRedundancyIfPossible = true};
65 }66 }
6667
67 #endregion68 #endregion
6869
70 #region DI properties
71
72 /// <summary>
73 /// Gets and sets the code member factory used to generate the class members.
74 /// </summary>
75 public ICodeMemberFactory CodeMemberFactory { get; set; }
76
77 #endregion
78
69 #region Public Methods Exposed by Interface79 #region Public Methods Exposed by Interface
7080
71 public CodeMemberMethod Create(method methodInstance, HashSet<string> nameSpaces, CodeNamespace ns, CodeTypeDeclaration typeDeclaration)81 public CodeMemberMethod Create(method methodInstance, HashSet<string> nameSpaces,
82 CodeNamespace ns, CodeTypeDeclaration typeDeclaration)
72 {83 {
73 // Create am instance of CodeMemberMethod and set it's name84 // Create am instance of CodeMemberMethod and set it's name
74 CodeMemberMethod memberMethod = new CodeMemberMethod85 var memberMethod = CodeMemberFactory.CreateCodeMember(methodInstance.id,
75 {86 typeDeclaration);
76 Name = _createIdentifier(methodInstance.id),
77 Attributes = MemberAttributes.Public | MemberAttributes.Final
78 };
7987
80 typeDeclarationField = typeDeclaration;88 typeDeclarationField = typeDeclaration;
8189
@@ -142,11 +150,8 @@
142 if (paramSet != null)150 if (paramSet != null)
143 {151 {
144 // Create am instance of CodeMemberMethod and set it's name152 // Create am instance of CodeMemberMethod and set it's name
145 CodeMemberMethod memberMethod = new CodeMemberMethod153 var memberMethod = CodeMemberFactory.CreateCodeMember(methodInstance.id,
146 {154 typeDeclaration);
147 Name = _createIdentifier(methodInstance.id),
148 Attributes = MemberAttributes.Public | MemberAttributes.Final
149 };
150155
151 typeDeclarationField = typeDeclaration;156 typeDeclarationField = typeDeclaration;
152157
153158
=== modified file 'LpNet.WadlSharp.Common/LpNet.WadlSharp.Common.csproj'
--- LpNet.WadlSharp.Common/LpNet.WadlSharp.Common.csproj 2010-09-22 11:11:05 +0000
+++ LpNet.WadlSharp.Common/LpNet.WadlSharp.Common.csproj 2010-09-22 11:11:05 +0000
@@ -50,6 +50,7 @@
50 <Compile Include="Enum\HttpMethod.cs" />50 <Compile Include="Enum\HttpMethod.cs" />
51 <Compile Include="Enum\LanguageConstructType.cs" />51 <Compile Include="Enum\LanguageConstructType.cs" />
52 <Compile Include="Generator\LpClassFactory.cs" />52 <Compile Include="Generator\LpClassFactory.cs" />
53 <Compile Include="Generator\LpCodeMemberFactory.cs" />
53 <Compile Include="Interface\Generator\IClassFactory.cs" />54 <Compile Include="Interface\Generator\IClassFactory.cs" />
54 <Compile Include="Generator\LpClass.cs" />55 <Compile Include="Generator\LpClass.cs" />
55 <Compile Include="Generator\LpComment.cs" />56 <Compile Include="Generator\LpComment.cs" />
@@ -67,6 +68,7 @@
67 <DependentUpon>IdentifierNames.resx</DependentUpon>68 <DependentUpon>IdentifierNames.resx</DependentUpon>
68 </Compile>69 </Compile>
69 <Compile Include="Interface\Generator\IClass.cs" />70 <Compile Include="Interface\Generator\IClass.cs" />
71 <Compile Include="Interface\Generator\ICodeMemberFactory.cs" />
70 <Compile Include="Interface\Generator\IComment.cs" />72 <Compile Include="Interface\Generator\IComment.cs" />
71 <Compile Include="Interface\Generator\IConstructor.cs" />73 <Compile Include="Interface\Generator\IConstructor.cs" />
72 <Compile Include="Interface\Generator\IEnum.cs" />74 <Compile Include="Interface\Generator\IEnum.cs" />
7375
=== modified file 'LpNet.WadlSharp.UnitTest/LpNet.WadlSharp.UnitTest.csproj'
--- LpNet.WadlSharp.UnitTest/LpNet.WadlSharp.UnitTest.csproj 2010-09-22 11:11:05 +0000
+++ LpNet.WadlSharp.UnitTest/LpNet.WadlSharp.UnitTest.csproj 2010-09-22 11:11:05 +0000
@@ -54,6 +54,7 @@
54 </ItemGroup>54 </ItemGroup>
55 <ItemGroup>55 <ItemGroup>
56 <Compile Include="Generator\LpClassFactoryFixture.cs" />56 <Compile Include="Generator\LpClassFactoryFixture.cs" />
57 <Compile Include="Generator\LpCodeMemberFactoryFixture.cs" />
57 <Compile Include="Generator\LpNamespaceFixture.cs" />58 <Compile Include="Generator\LpNamespaceFixture.cs" />
58 <Compile Include="Serialize\MultiFileCodeSerializerFixture.cs" />59 <Compile Include="Serialize\MultiFileCodeSerializerFixture.cs" />
59 <Compile Include="Serialize\SingleFileCodeSerializerFixture.cs" />60 <Compile Include="Serialize\SingleFileCodeSerializerFixture.cs" />

Subscribers

People subscribed via source and target branches