Common

@InternalApi()
public final class Common

Common utility methods for the GenAI SDK.

Types

Link copied to clipboard
public class BuiltRequest
A class that holds the path, body, and http options of an API request.

Functions

Link copied to clipboard
public static String formatMap(String template, JsonNode data)
Link copied to clipboard
@Nullable()
public static Object getValueByPath(JsonNode object, Array<String> keys)
Gets the value of an object by a path.
@Nullable()
public static Object getValueByPath(JsonNode object, Array<String> keys, @Nullable() Object defaultValue)
Gets the value of an object by a path, returning a default value if the path does not exist.
Link copied to clipboard
public static boolean isZero(Object obj)
Link copied to clipboard
public static void moveValueByPath(JsonNode data, Map<String, String> paths)
Moves values from source paths to destination paths.
Link copied to clipboard
public static void moveValueRecursive(JsonNode data, Array<String> sourceKeys, Array<String> destKeys, int keyIdx, Set<String> excludeKeys)
Recursively moves values from source path to destination path.
Link copied to clipboard
public static void setValueByPath(ObjectNode jsonObject, Array<String> path, Object value)
Sets the value of an object by a path.
Link copied to clipboard
public static String snakeToCamel(String str)
Converts a snake_case string to camelCase.
Link copied to clipboard
public static String urlEncode(ObjectNode paramsNode)
Converts a Jackson ObjectNode into a URL-encoded query string.