Class CodeGenUtils

java.lang.Object
io.clientcore.annotation.processor.utils.CodeGenUtils

public final class CodeGenUtils extends Object
This class contains utility methods for encoding query parameters, quoting header values, and other helpers for code generation.
  • Method Details

    • encodeQueryParamValue

      public static String encodeQueryParamValue(String value)
      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

      public static String quoteHeaderValue(String value)
      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

      public static String toJavaArrayInitializer(List<String> values, boolean quote)
      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.