/** * Splits a constructor in two if the constructor contains a parameter of type UUID. The first * constructor is unchanged, while the second constructor has all UUID parameters converted into * strings. If the constructor does not have a UUID parameter, then the original constructor is * returned. */ protected static ImmutableList<RequestConstructor> splitUuidConstructor( final RequestConstructor constructor) { final ImmutableList.Builder<RequestConstructor> builder = ImmutableList.builder(); builder.add(constructor); if (!containsType(constructor.getParameters(), "UUID")) { return builder.build(); } builder.add(convertUuidConstructorToStringConstructor(constructor)); return builder.build(); }
/** Converts all UUID types into Strings within a given request constructor */ protected static RequestConstructor convertUuidConstructorToStringConstructor( final RequestConstructor constructor) { final String curType = "UUID"; final String newType = "String"; return new RequestConstructor( constructor.isDeprecated(), constructor.getAdditionalLines(), modifyType(constructor.getParameters(), curType, newType), modifyType(constructor.getAssignments(), curType, newType), modifyQueryParamType(constructor.getQueryParams(), curType, newType), constructor.getDocumentation()); }