Skip to content

Commit

Permalink
Fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Kedida committed Dec 12, 2023
1 parent 7781366 commit 5999d2c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ private Optional<ArgumentType> getPrimitiveType(TypeMirror typeMirror) {

private Optional<ArgumentType> getListType(TypeMirror typeMirror) {
TypeName typeName = TypeName.get(typeMirror);
Optional<TypeMirror> innerTypeMirror = context.getGenericInnerType(List.class, typeMirror);

return innerTypeMirror
return context.getGenericInnerType(List.class, typeMirror)
.flatMap(this::getListInnerType)
.map(argumentType -> ArgumentTypes.list(
typeName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,16 @@ private CodeBlock generatePlainSerializer(
Optional<ParameterEncoderType> maybeParameterEncoderType) {
return type.match(new ArgumentType.Cases<>() {
@Override
public CodeBlock primitive(TypeName _typeName, String _parameterSerializerMethodName) {
public CodeBlock primitive(TypeName _typeName, String parameterSerializerMethodName) {
return maybeParameterEncoderType.map(this::parameterEncoderType).orElseGet(() -> {
return CodeBlock.of(
"$L.$L($S, $L);", REQUEST, singleValueMethod, key, generateSerializerCall(argName, type));
"$L.$L($S, $L.$L($L));",
REQUEST,
singleValueMethod,
key,
PARAMETER_SERIALIZER,
parameterSerializerMethodName,
argName);
});
}

Expand All @@ -307,10 +313,16 @@ public CodeBlock list(TypeName _typeName, ListType listType) {
}

@Override
public CodeBlock alias(TypeName _typeName, String _parameterSerializerMethodName) {
public CodeBlock alias(TypeName _typeName, String parameterSerializerMethodName) {
return maybeParameterEncoderType.map(this::parameterEncoderType).orElseGet(() -> {
return CodeBlock.of(
"$L.$L($S, $L);", REQUEST, singleValueMethod, key, generateSerializerCall(argName, type));
"$L.$L($S, $L.$L($L.get()));",
REQUEST,
singleValueMethod,
key,
PARAMETER_SERIALIZER,
parameterSerializerMethodName,
argName);
});
}

Expand Down

0 comments on commit 5999d2c

Please sign in to comment.