Class CodeGenUtils
java.lang.Object
io.clientcore.annotation.processor.utils.CodeGenUtils
This class contains utility methods for encoding query parameters, quoting header values,
and other helpers for code generation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringencodeQueryParamValue(String value) Encodes a query parameter value for use in generated code.static StringquoteHeaderValue(String value) Applies the following quoting logic to a header value.static StringtoJavaArrayInitializer(List<String> values, boolean quote) Joins a list of values into a Java code array initializer.
-
Method Details
-
encodeQueryParamValue
Encodes a query parameter value for use in generated code.- Parameters:
value- The value to encode.- Returns:
- The Java code string for encoding the value.
-
quoteHeaderValue
Applies the following quoting logic to a header value.If the value starts and ends with a quote, returns as-is. If it starts with a quote, appends a trailing quote. If it ends with a quote, prepends a leading quote. Otherwise, wraps the value in quotes.
- Parameters:
value- The header value to quote.- Returns:
- The quoted header value as a String.
-
toJavaArrayInitializer
Joins a list of values into a Java code array initializer.- Parameters:
values- The values to join.quote- Whether to quote each value.- Returns:
- The Java code array initializer string.
-