Skip to content

Commit

Permalink
Merge branch 'main' into feature/generate-from-version-1-170-0
Browse files Browse the repository at this point in the history
  • Loading branch information
KSGRelewise committed Sep 26, 2024
2 parents a2d7c89 + 2911369 commit 101186e
Show file tree
Hide file tree
Showing 46 changed files with 400 additions and 109 deletions.
4 changes: 2 additions & 2 deletions Generator/JavaMemberWriters/JavaCreatorMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private void WriteCreatorMethodBody(IndentedTextWriter writer, string variable,
if (propertyName is not null)
{
if (property!.PropertyType.IsGenericType && property!.PropertyType.GetGenericTypeDefinition() == typeof(List<>) && (parameter.ParameterType.IsArray
|| (parameter == parameters.Last() && javaWriter.BetterTypedParameterTypeName(parameter.ParameterType, new NullabilityInfoContext().Create(parameter)).Contains("..."))))
|| (parameter == parameters.Last() && javaWriter.BetterTypedParameterTypeName(parameter).Contains("..."))))
{
writer.WriteLine($"{variable}.{propertyName.AsFieldName()} = new ArrayList<>(Arrays.asList({parameter.Name.AsFieldName()}));");
}
Expand Down Expand Up @@ -262,7 +262,7 @@ private string ParameterList(ParameterInfo[] parameters)
{
return string.Join(", ",
parameters.Select(parameter =>
$"{(parameters[^1] == parameter ? javaWriter.BetterTypedParameterTypeName(parameter.ParameterType, new NullabilityInfoContext().Create(parameter)) : javaWriter.TypeName(parameter))} {parameter.Name.AsFieldName()}"
$"{(parameters[^1] == parameter ? javaWriter.BetterTypedParameterTypeName(parameter) : javaWriter.TypeName(parameter))} {parameter.Name.AsFieldName()}"
)
);
}
Expand Down
7 changes: 5 additions & 2 deletions Generator/JavaWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ private static string PrependNullableIfApplicable(string typeName, NullabilityIn
return typeName;
}

public string BetterTypedParameterTypeName(Type parameterType, NullabilityInfo nullabilityInfo)
public string BetterTypedParameterTypeName(ParameterInfo parameter)
{
Type parameterType = parameter.ParameterType;
var nullabilityInfo = new NullabilityInfoContext().Create(parameter);

if (nullabilityInfo.WriteState is NullabilityState.Nullable)
{
parameterType = nullabilityInfo.Type;
Expand All @@ -114,7 +117,7 @@ parameterType.GenericTypeArguments is [var elementType]
? TypeName(elementType) + "..."
: parameterType.IsArray
? TypeName(parameterType.GetElementType()!) + "..."
: TypeName(parameterType);
: PrependNullableIfApplicable(TypeName(parameterType), nullabilityInfo);
}

public string BetterTypedParameterTypeName(PropertyInfo property, NullabilityInfo nullabilityInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public static DataValue create(double value) {
.setValue(value);
}

public static DataValue create(boolean value) {
return DataValue.create()
.setType(DataValueDataValueTypes.Boolean)
.setValue(value);
}

public static DataValue create(MultiCurrency value) {
return DataValue.create()
.setType(DataValueDataValueTypes.MultiCurrency)
Expand Down
4 changes: 2 additions & 2 deletions src/src/main/java/com/relewise/client/model/Advertiser.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public class Advertiser extends AdvertiserEntityStateAdvertiserMetadataValuesRet
public @Nullable PromotionSpecificationCollection allowedPromotions;
/** Defines locations/placements/variations where this advertiser is allowed to make promotions at. If <code>null</code> or empty, an advertiser will not be allowed to make any promotions anywhere, only useful for Advertisers in draft. */
public @Nullable PromotionLocationCollection allowedLocations;
public static Advertiser create(@Nullable UUID id, AdvertiserEntityState state, String name, @Nullable PromotionSpecificationCollection allowedPromotions, PromotionLocationCollection allowedLocations)
public static Advertiser create(@Nullable UUID id, AdvertiserEntityState state, String name, @Nullable PromotionSpecificationCollection allowedPromotions, @Nullable PromotionLocationCollection allowedLocations)
{
return new Advertiser(id, state, name, allowedPromotions, allowedLocations);
}
public Advertiser(@Nullable UUID id, AdvertiserEntityState state, String name, @Nullable PromotionSpecificationCollection allowedPromotions, PromotionLocationCollection allowedLocations)
public Advertiser(@Nullable UUID id, AdvertiserEntityState state, String name, @Nullable PromotionSpecificationCollection allowedPromotions, @Nullable PromotionLocationCollection allowedLocations)
{
this.id = id;
this.state = state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public BrandDataFilter(String key, String... objectPath)
this.language = null;
this.currency = null;
}
public static BrandDataFilter create(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static BrandDataFilter create(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new BrandDataFilter(key, objectPath, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public BrandDataFilter(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public BrandDataFilter(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.objectPath = objectPath;
Expand All @@ -67,11 +67,11 @@ public BrandDataFilter(String key)
this.language = null;
this.currency = null;
}
public static BrandDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static BrandDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new BrandDataFilter(key, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public BrandDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public BrandDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.conditions = conditions;
Expand Down
4 changes: 2 additions & 2 deletions src/src/main/java/com/relewise/client/model/BrandQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public BrandQuery()
this.language = null;
this.currency = null;
}
public static BrandQuery create(@Nullable Language language, Currency currency)
public static BrandQuery create(@Nullable Language language, @Nullable Currency currency)
{
return new BrandQuery(language, currency);
}
public BrandQuery(@Nullable Language language, Currency currency)
public BrandQuery(@Nullable Language language, @Nullable Currency currency)
{
this.language = language;
this.currency = currency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public class CampaignAnalyticsRequest extends LicensedRequest
public UUID id;
public LocalDateTimeRange periodUtc;
public @Nullable FilterCollection filters;
public static CampaignAnalyticsRequest create(UUID id, LocalDateTimeRange periodUtc, FilterCollection filters)
public static CampaignAnalyticsRequest create(UUID id, LocalDateTimeRange periodUtc, @Nullable FilterCollection filters)
{
return new CampaignAnalyticsRequest(id, periodUtc, filters);
}
public CampaignAnalyticsRequest(UUID id, LocalDateTimeRange periodUtc, FilterCollection filters)
public CampaignAnalyticsRequest(UUID id, LocalDateTimeRange periodUtc, @Nullable FilterCollection filters)
{
this.id = id;
this.periodUtc = periodUtc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public CartDataFilter(String key)
this.language = null;
this.currency = null;
}
public static CartDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static CartDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new CartDataFilter(key, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public CartDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public CartDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.conditions = conditions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public CategoryNameAndId(String id)
* @param id The ID of the category (Which is generally very unlikely to change in the future)
* @param displayName The Display name of the category (More likely to change in the future)
*/
public static CategoryNameAndId create(String id, Multilingual displayName)
public static CategoryNameAndId create(String id, @Nullable Multilingual displayName)
{
return new CategoryNameAndId(id, displayName);
}
Expand All @@ -46,7 +46,7 @@ public static CategoryNameAndId create(String id, Multilingual displayName)
* @param id The ID of the category (Which is generally very unlikely to change in the future)
* @param displayName The Display name of the category (More likely to change in the future)
*/
public CategoryNameAndId(String id, Multilingual displayName)
public CategoryNameAndId(String id, @Nullable Multilingual displayName)
{
this.id = id;
this.displayName = displayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public CompanyDataFilter(String key, String... objectPath)
this.language = null;
this.currency = null;
}
public static CompanyDataFilter create(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static CompanyDataFilter create(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new CompanyDataFilter(key, objectPath, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public CompanyDataFilter(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public CompanyDataFilter(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.objectPath = objectPath;
Expand All @@ -67,11 +67,11 @@ public CompanyDataFilter(String key)
this.language = null;
this.currency = null;
}
public static CompanyDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static CompanyDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new CompanyDataFilter(key, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public CompanyDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public CompanyDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.conditions = conditions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public ContentCategoryDataFilter(String key, String... objectPath)
this.language = null;
this.currency = null;
}
public static ContentCategoryDataFilter create(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static ContentCategoryDataFilter create(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new ContentCategoryDataFilter(key, objectPath, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public ContentCategoryDataFilter(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public ContentCategoryDataFilter(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.objectPath = objectPath;
Expand All @@ -67,11 +67,11 @@ public ContentCategoryDataFilter(String key)
this.language = null;
this.currency = null;
}
public static ContentCategoryDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static ContentCategoryDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new ContentCategoryDataFilter(key, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public ContentCategoryDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public ContentCategoryDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.conditions = conditions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public ContentCategoryQuery()
this.language = null;
this.currency = null;
}
public static ContentCategoryQuery create(@Nullable Language language, Currency currency)
public static ContentCategoryQuery create(@Nullable Language language, @Nullable Currency currency)
{
return new ContentCategoryQuery(language, currency);
}
public ContentCategoryQuery(@Nullable Language language, Currency currency)
public ContentCategoryQuery(@Nullable Language language, @Nullable Currency currency)
{
this.language = language;
this.currency = currency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
public class ContentDataDoubleRangeFacet extends DoubleContentDataRangeFacet
{
public String $type = "Relewise.Client.DataTypes.Search.Facets.Queries.ContentDataDoubleRangeFacet, Relewise.Client";
public static ContentDataDoubleRangeFacet create(String key, DoubleRange selected)
public static ContentDataDoubleRangeFacet create(String key, @Nullable DoubleRange selected)
{
return new ContentDataDoubleRangeFacet(key, selected);
}
public ContentDataDoubleRangeFacet(String key, DoubleRange selected)
public ContentDataDoubleRangeFacet(String key, @Nullable DoubleRange selected)
{
this.key = key;
this.selected = selected;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public ContentDataFilter(String key, String... objectPath)
this.language = null;
this.currency = null;
}
public static ContentDataFilter create(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static ContentDataFilter create(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new ContentDataFilter(key, objectPath, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public ContentDataFilter(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public ContentDataFilter(String key, String[] objectPath, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.objectPath = objectPath;
Expand All @@ -67,11 +67,11 @@ public ContentDataFilter(String key)
this.language = null;
this.currency = null;
}
public static ContentDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public static ContentDataFilter create(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
return new ContentDataFilter(key, conditions, mustMatchAllConditions, filterOutIfKeyIsNotFound, language, currency);
}
public ContentDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, Currency currency)
public ContentDataFilter(String key, @Nullable ValueConditionCollection conditions, Boolean mustMatchAllConditions, Boolean filterOutIfKeyIsNotFound, @Nullable Language language, @Nullable Currency currency)
{
this.key = key;
this.conditions = conditions;
Expand Down
4 changes: 2 additions & 2 deletions src/src/main/java/com/relewise/client/model/ContentQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public ContentQuery()
this.language = null;
this.currency = null;
}
public static ContentQuery create(@Nullable Language language, Currency currency)
public static ContentQuery create(@Nullable Language language, @Nullable Currency currency)
{
return new ContentQuery(language, currency);
}
public ContentQuery(@Nullable Language language, Currency currency)
public ContentQuery(@Nullable Language language, @Nullable Currency currency)
{
this.language = language;
this.currency = currency;
Expand Down
Loading

0 comments on commit 101186e

Please sign in to comment.