Skip to content

Replace isNativeSimpleType with Boolean/Number check #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,6 @@ public void generateSharedComponents(GenerationContext context) {
HttpProtocolGeneratorUtils.generateHttpBindingUtils(context);
}

/**
* Detects if the target shape is expressed as a native simple type.
*
* @param target The shape of the value being provided.
* @return Returns if the shape is a native simple type.
*/
private boolean isNativeSimpleType(Shape target) {
return target instanceof BooleanShape || target instanceof NumberShape || target instanceof StringShape;
}

@Override
public void generateRequestSerializers(GenerationContext context) {
TopDownIndex topDownIndex = TopDownIndex.of(context.getModel());
Expand Down Expand Up @@ -452,7 +442,7 @@ protected String getInputValue(
} else if (target instanceof FloatShape || target instanceof DoubleShape) {
// Handle decimal numbers needing to have .0 in their value when whole numbers.
return "((" + dataSource + " % 1 == 0) ? " + dataSource + " + \".0\" : " + dataSource + ".toString())";
} else if (isNativeSimpleType(target)) {
} else if (target instanceof BooleanShape || target instanceof NumberShape) {
return dataSource + ".toString()";
} else if (target instanceof TimestampShape) {
return getTimestampInputParam(context, bindingType, dataSource, member);
Expand Down