From 7c3687c34c2226b8f67a85a17c7afba837bd8fcf Mon Sep 17 00:00:00 2001 From: "snorkell-ai[bot]" <146478655+snorkell-ai[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 20:25:42 +0000 Subject: [PATCH] [Snorkell.ai]: Documentation for ColorUtil.java --- .../calculator/util/ColorUtil.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/houarizegai/calculator/util/ColorUtil.java b/src/main/java/com/houarizegai/calculator/util/ColorUtil.java index c2d0e4a..3536f0b 100644 --- a/src/main/java/com/houarizegai/calculator/util/ColorUtil.java +++ b/src/main/java/com/houarizegai/calculator/util/ColorUtil.java @@ -13,11 +13,14 @@ private ColorUtil() { * Converts a hexadecimal color code to a Color object. * * @param colorHex the hexadecimal color code to convert - * @return the Color object representing the hexadecimal color code, or null if the input is null + * @return the Color object representing the given hexadecimal color code, or null if the input is null * @throws NumberFormatException if the input is not a valid hexadecimal color code - * @example - * Color color = hex2Color("#FF0000"); - * // color is now a Color object representing the color red + * @throws StringIndexOutOfBoundsException if the input is not of the expected length + * + * Example: + *
{@code
+     * Color color = hex2Color("FFA500");
+     * }
*/ public static Color hex2Color(String colorHex) { // test 1 @@ -27,6 +30,20 @@ public static Color hex2Color(String colorHex) { Integer.valueOf(colorHex.substring(2, 4), 16), Integer.valueOf(colorHex.substring(4, 6), 16))) .orElse(null); + /** + * Converts a hexadecimal color code to a Color object. + * + * @param colorHex the hexadecimal color code to convert + * @param dType the type of color representation + * @return the Color object representing the given hexadecimal color code, or null if the input is null + * @throws NumberFormatException if the input hexadecimal color code is not in the expected format + * @throws NullPointerException if the input colorHex is null + * + * Example: + *
{@code
+     * Color color = hex2Color("FFA500", "RGB");
+     * }
+ */ }