Skip to content

Commit f843e3b

Browse files
committed
rename NamespaceName to AddPrefix
1 parent 0755da5 commit f843e3b

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

Templates/Java/requests_extensions/BaseEntityRequestBuilder.java.tt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ if (c.AsOdcmClass() != null)
246246
typeString = typeString.Substring(0, typeString.Length-1);
247247
}
248248
sb.AppendFormat(importFormat,
249-
p.Type.Namespace.Name.NamespaceName(),
249+
p.Type.Namespace.Name.AddPrefix(),
250250
p.GetPackagePrefix(),
251251
typeString);
252252
sb.Append("\n");
@@ -255,25 +255,25 @@ if (c.AsOdcmClass() != null)
255255

256256
if (method.IsCollection) {
257257
sb.AppendFormat(importFormat,
258-
method.Namespace.Name.NamespaceName(),
258+
method.Namespace.Name.AddPrefix(),
259259
"requests.extensions",
260260
method.ITypeCollectionRequestBuilder());
261261
sb.Append("\n");
262262

263263
sb.AppendFormat(importFormat,
264-
method.Namespace.Name.NamespaceName(),
264+
method.Namespace.Name.AddPrefix(),
265265
"requests.extensions",
266266
method.TypeCollectionRequestBuilder());
267267
sb.Append("\n");
268268
} else {
269269
sb.AppendFormat(importFormat,
270-
method.Namespace.Name.NamespaceName(),
270+
method.Namespace.Name.AddPrefix(),
271271
"requests.extensions",
272272
method.ITypeRequestBuilder());
273273
sb.Append("\n");
274274

275275
sb.AppendFormat(importFormat,
276-
method.Namespace.Name.NamespaceName(),
276+
method.Namespace.Name.AddPrefix(),
277277
"requests.extensions",
278278
method.TypeRequestBuilder());
279279
sb.Append("\n");

Templates/Java/requests_extensions/Client.java.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<#=writer.WriteHeader()#>
66
<#=host.CreatePackageDef()#>
77

8-
import <#=host.CurrentModel.GetNamespace().NamespaceName()#>.authentication.*;
9-
import <#=host.CurrentModel.GetNamespace().NamespaceName()#>.logger.*;
8+
import <#=host.CurrentModel.GetNamespace().AddPrefix()#>.authentication.*;
9+
import <#=host.CurrentModel.GetNamespace().AddPrefix()#>.logger.*;
1010
import com.google.gson.JsonObject;
1111

1212
<#=TypeHelperJava.CreateClassDef(c.ClientType(host), c.BaseClientType(host), c.IClientType(host))#>

Templates/Java/requests_extensions/IBaseEntityRequestBuilder.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ if (c.AsOdcmClass() != null)
197197
typeString = typeString.Substring(0, typeString.Length-1);
198198
}
199199
sb.AppendFormat(importFormat,
200-
p.Type.Namespace.Name.NamespaceName(),
200+
p.Type.Namespace.Name.AddPrefix(),
201201
p.GetPackagePrefix(),
202202
typeString);
203203
sb.Append("\n");
@@ -206,13 +206,13 @@ if (c.AsOdcmClass() != null)
206206

207207
if (method.IsCollection) {
208208
sb.AppendFormat(importFormat,
209-
method.Namespace.Name.NamespaceName(),
209+
method.Namespace.Name.AddPrefix(),
210210
"requests.extensions",
211211
method.ITypeCollectionRequestBuilder());
212212
sb.Append("\n");
213213
} else {
214214
sb.AppendFormat(importFormat,
215-
method.Namespace.Name.NamespaceName(),
215+
method.Namespace.Name.AddPrefix(),
216216
"requests.extensions",
217217
method.ITypeRequestBuilder());
218218
sb.Append("\n");

src/GraphODataTemplateWriter/CodeHelpers/Java/TypeHelperJava.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ public static string MethodParametersJavadocSignature(this OdcmMethod method)
608608
return parameterSignatureBuilder.ToString();
609609
}
610610

611-
public static string GetPropertyNamespace(this OdcmProperty p) => p.Projection.Type.Namespace.Name.NamespaceName();
611+
public static string GetPropertyNamespace(this OdcmProperty p) => p.Projection.Type.Namespace.Name.AddPrefix();
612612

613613
public static string MethodParametersSignature(this OdcmMethod method)
614614
{
@@ -861,7 +861,7 @@ public static StringBuilder ImportClassesOfMethodParameters(OdcmMethod method, s
861861
appendEnumSet = true;
862862
}
863863

864-
importStatements.Add(string.Format(importFormat, p.Type.Namespace.Name.NamespaceName(), p.GetPackagePrefix(), propertyType));
864+
importStatements.Add(string.Format(importFormat, p.Type.Namespace.Name.AddPrefix(), p.GetPackagePrefix(), propertyType));
865865
}
866866
}
867867

@@ -1017,7 +1017,7 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
10171017
import {0}.http.*;
10181018
import {0}.serializer.*;
10191019
import java.util.Arrays;
1020-
import java.util.EnumSet;", host.CurrentModel.GetNamespace().NamespaceName());
1020+
import java.util.EnumSet;", host.CurrentModel.GetNamespace().AddPrefix());
10211021

10221022
sb.Append("\n");
10231023
var importFormat = @"import {0}.{1}.{2};";
@@ -1037,7 +1037,7 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
10371037

10381038
string prefixValue = property.GetPackagePrefix();
10391039
string importstr = String.Format(importFormat,
1040-
property.Projection.Type.Namespace.Name.NamespaceName(),
1040+
property.Projection.Type.Namespace.Name.AddPrefix(),
10411041
prefixValue,
10421042
propertyType);
10431043
if (!uniqueStore.ContainsKey(importstr))
@@ -1054,7 +1054,7 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
10541054
{
10551055
string prefixValue = GetPrefixForModels();
10561056
string importstr = String.Format(importFormat,
1057-
(host.CurrentType.BaseClass() as OdcmClass).Namespace.Name.NamespaceName(),
1057+
(host.CurrentType.BaseClass() as OdcmClass).Namespace.Name.AddPrefix(),
10581058
prefixValue,
10591059
baseClassNameType);
10601060
if (!uniqueStore.ContainsKey(importstr))
@@ -1069,7 +1069,7 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
10691069
if (baseTypeNameStr == "BasePlannerAssignments")
10701070
{
10711071
string importstr = String.Format(importFormat,
1072-
host.CurrentModel.GetNamespace().NamespaceName(),
1072+
host.CurrentModel.GetNamespace().AddPrefix(),
10731073
"models.extensions",
10741074
"PlannerAssignment");
10751075
if (!uniqueStore.ContainsKey(importstr))
@@ -1082,7 +1082,7 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
10821082
if (baseTypeNameStr == "BasePlannerChecklistItems")
10831083
{
10841084
string importstr = String.Format(importFormat,
1085-
host.CurrentModel.GetNamespace().NamespaceName(),
1085+
host.CurrentModel.GetNamespace().AddPrefix(),
10861086
"models.extensions",
10871087
"PlannerChecklistItem");
10881088
if (!uniqueStore.ContainsKey(importstr))
@@ -1102,7 +1102,7 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
11021102

11031103
var propertyType = TypeCollectionResponse(property);
11041104
string importstr = String.Format(importFormat,
1105-
property.Projection.Type.Namespace.Name.NamespaceName(),
1105+
property.Projection.Type.Namespace.Name.AddPrefix(),
11061106
GetPrefixForRequests(),
11071107
propertyType);
11081108
if (!uniqueStore.ContainsKey(importstr))
@@ -1114,7 +1114,7 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
11141114

11151115
string propertyValue = TypeCollectionPage(property);
11161116
string importstr1 = String.Format(importFormat,
1117-
property.Projection.Type.Namespace.Name.NamespaceName(),
1117+
property.Projection.Type.Namespace.Name.AddPrefix(),
11181118
GetPrefixForRequests(),
11191119
propertyValue);
11201120
if (!uniqueStore.ContainsKey(importstr1))
@@ -1151,7 +1151,7 @@ public static string CreatePackageDef(this CustomT4Host host)
11511151
switch (host.CurrentType)
11521152
{
11531153
case OdcmProperty p:
1154-
@namespace = p.Type.Namespace.Name.NamespaceName();
1154+
@namespace = p.Type.Namespace.Name.AddPrefix();
11551155
break;
11561156
case OdcmMethod m:
11571157
var sb = new StringBuilder(Environment.NewLine);
@@ -1165,7 +1165,7 @@ public static string CreatePackageDef(this CustomT4Host host)
11651165
return string.Format(format,
11661166
@namespace,
11671167
host.TemplateInfo.OutputParentDirectory.Replace("_", "."),
1168-
host.CurrentModel.GetNamespace().NamespaceName(),
1168+
host.CurrentModel.GetNamespace().AddPrefix(),
11691169
fullyQualifiedImport,
11701170
methodImports);
11711171
}
@@ -1175,9 +1175,9 @@ public static string CurrentNamespace(this CustomT4Host host)
11751175
switch (host.CurrentType)
11761176
{
11771177
case OdcmType t:
1178-
return t.Namespace.Name.NamespaceName();
1178+
return t.Namespace.Name.AddPrefix();
11791179
case OdcmProperty p:
1180-
return p.Projection.Type.Namespace.Name.NamespaceName();
1180+
return p.Projection.Type.Namespace.Name.AddPrefix();
11811181
default:
11821182
return string.Empty;
11831183
}

src/GraphODataTemplateWriter/Extensions/OdcmModelExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public static string GetFullyQualifiedImportStatementForModel(this CustomT4Host
205205
{
206206
// Form the import statement to disambiguate the model in the generated code file.
207207
var thisType = (host.CurrentType as OdcmProperty).Projection.Type;
208-
var thisNamespace = thisType.Namespace.Name.NamespaceName();
208+
var thisNamespace = thisType.Namespace.Name.AddPrefix();
209209
var thisTypeName = thisType.Name.ToUpperFirstChar();
210210
importStatement = $"\nimport {thisNamespace}.models.extensions.{thisTypeName};";
211211
}
@@ -423,12 +423,12 @@ public static bool HasDerived(this OdcmObject odcmObject)
423423
return false;
424424
}
425425

426-
public static string NamespaceName(this OdcmNamespace @namespace)
426+
public static string AddPrefix(this OdcmNamespace @namespace)
427427
{
428-
return @namespace.ToString().NamespaceName();
428+
return @namespace.ToString().AddPrefix();
429429
}
430430

431-
public static string NamespaceName(this string @namespace)
431+
public static string AddPrefix(this string @namespace)
432432
{
433433
if (string.IsNullOrEmpty(ConfigurationService.Settings.NamespaceOverride))
434434
{

src/GraphODataTemplateWriter/PathWriters/JavaPathWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override string WritePath(ITemplateInfo template, string @namespace, stri
4141

4242
private string CreateNamespace(string folderName, string @namespace = null)
4343
{
44-
@namespace = @namespace ?? this.Model.GetNamespace().NamespaceName();
44+
@namespace = @namespace ?? this.Model.GetNamespace().AddPrefix();
4545
var prefix = ConfigurationService.Settings.NamespacePrefix;
4646

4747
if (String.IsNullOrEmpty(ConfigurationService.Settings.NamespaceOverride))

0 commit comments

Comments
 (0)