Skip to content

Commit 4902585

Browse files
author
Caitlin Bales (MSFT)
committed
Remove custom code imports and extension writing from Java project
1 parent 3f7f83d commit 4902585

File tree

10 files changed

+44
-354
lines changed

10 files changed

+44
-354
lines changed

Templates/Java/BaseJavaModel.template.tt

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -797,36 +797,6 @@ public {1} {2}{3}{4} {{";
797797
@"// **NOTE** This file was generated by a tool and any changes will be overwritten.";
798798
}
799799

800-
/*
801-
* Add additional methods to a generated class
802-
* @param className The class that you will be adding methods to
803-
* @return The additional text to add to the generated file
804-
*/
805-
public string AddCustomCode(string className) {
806-
CustomMethods customMethods = new CustomMethods();
807-
var type = customMethods.GetType();
808-
var property = type.GetFields().Where(x => x.Name == className).FirstOrDefault();
809-
810-
if (property != null) {
811-
return "\r\n\r\n" + property.GetValue(customMethods).ToString();
812-
} else {
813-
return string.Empty;
814-
}
815-
}
816-
817-
/*
818-
* Add additional import statements to a generated class
819-
* @param className The class that you will be adding methods to
820-
* @return The additional text to add to the generated file
821-
*/
822-
public string AddCustomImport(string className) {
823-
CustomImports customImports = new CustomImports();
824-
var type = customImports.GetType();
825-
var property = type.GetFields().Where(x => x.Name == className).FirstOrDefault();
826-
827-
return property != null ? property.GetValue(customImports).ToString() : string.Empty;
828-
}
829-
830800
/*
831801
* Find and replace overwrite values for the given class
832802
* @param className The class that you will be applying overwrites to

Templates/Java/extensions/ChunkedUploadRequest.java.tt

Lines changed: 0 additions & 130 deletions
This file was deleted.

Templates/Java/extensions/ChunkedUploadResult.java.tt

Lines changed: 0 additions & 126 deletions
This file was deleted.

Templates/Java/requests_extensions/EntityRequestBuilder.java.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
*/
1818
public <#=TypeRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final java.util.List<Option> requestOptions) {
1919
super(requestUrl, client, requestOptions);
20-
}<#=AddCustomCode(TypeRequestBuilder(c))#>
20+
}
2121
}

Templates/Java/requests_extensions/IEntityRequestBuilder.java.tt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
<#=CreatePackageDef(host)#>
88

99
<#=CreateInterfaceDef(ITypeRequestBuilder(c), IBaseTypeRequestBuilder(c))#>
10-
<#=AddCustomCode(ITypeRequestBuilder(c))#>
1110
}
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
26

37
namespace Microsoft.Graph.ODataTemplateWriter.CodeHelpers.Android
48
{
@@ -8,8 +12,8 @@ namespace Microsoft.Graph.ODataTemplateWriter.CodeHelpers.Android
812
* The field name should be equal to the name of the class you wish to edit
913
* This will be used in BaseModel.template.tt in the AddCustomImports() method
1014
*/
11-
public class CustomImports : Java.CustomImports
15+
public class CustomImports
1216
{
13-
17+
public const string UploadSession = "import com.microsoft.graph.concurrency.ChunkedUploadProvider;\r\n";
1418
}
15-
}
19+
}
Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
26

37
namespace Microsoft.Graph.ODataTemplateWriter.CodeHelpers.Android
48
{
@@ -8,7 +12,34 @@ namespace Microsoft.Graph.ODataTemplateWriter.CodeHelpers.Android
812
* The field name should be equal to the name of the class you wish to edit
913
* This will be used in BaseModel.template.tt in the AddCustomCode() method
1014
*/
11-
public class CustomMethods : Java.CustomMethods
15+
public class CustomMethods
1216
{
17+
public const string DriveItemRequestBuilder =
18+
" @Override\r\n" +
19+
" public IDriveItemRequestBuilder getItemWithPath(final String path) {\r\n" +
20+
" return new DriveItemRequestBuilder(getRequestUrl() + \":/\" + path + \":\", getClient(), null);\r\n" +
21+
" }";
22+
23+
public const string IDriveItemRequestBuilder =
24+
" /**\r\n" +
25+
" * Gets the item request builder for the specified item path\r\n" +
26+
" * @param path The path to the item\r\n" +
27+
" * @return The request builder for the specified item\r\n" +
28+
" */\r\n" +
29+
" IDriveItemRequestBuilder getItemWithPath(final String path);";
30+
31+
public const string IThumbnailSetRequestBuilder =
32+
" /**\r\n" +
33+
" * Gets a request for a thumbnail of a specific size\r\n" +
34+
" * @param size The size to request (typically: small, medium, large)\r\n" +
35+
" * @return The request builder for that thumbnail size\r\n" +
36+
" */\r\n" +
37+
" IThumbnailRequestBuilder getThumbnailSize(final String size);";
38+
39+
public const string ThumbnailSetRequestBuilder =
40+
" @Override\r\n" +
41+
" public IThumbnailRequestBuilder getThumbnailSize(final String size) {\r\n" +
42+
" return new ThumbnailRequestBuilder(getRequestUrlWithAdditionalSegment(size), getClient(), /* options */ null);\r\n" +
43+
" }";
1344
}
14-
}
45+
}

src/GraphODataTemplateWriter/CodeHelpers/Java/CustomImports.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)