[FIX] doc generation

This commit is contained in:
Edouard DUPIN 2025-04-08 20:41:00 +02:00
parent 69f69a8113
commit 37629b4cb2
2 changed files with 17 additions and 11 deletions

View File

@ -1,7 +1,6 @@
package org.kar.archidata.tools;
import java.io.IOException;
import java.text.ParseException;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
@ -39,6 +38,15 @@ public class DateTools {
return parseOffsetDateTime(dateString, false);
}
/**
* Attempts to parse a date string into an OffsetDateTime using a flexible list of patterns.
* Supports ISO 8601 formats, optional zone, and fallback to LocalDate or LocalTime if needed.
*
* @param dateString the date string to parse
* @param missingAsUTC Parse date when missing the time zone consider it as a UTC Date-time
* @return OffsetDateTime representation of the parsed input
* @throws IOException if no supported format matches the input
*/
public static OffsetDateTime parseOffsetDateTime(final String dateString, final boolean missingAsUTC)
throws IOException {
if (dateString == null) {
@ -66,11 +74,11 @@ public class DateTools {
/**
* Parses a flexible date string and returns a java.util.Date,
* using system default timezone for conversion.
* using system default time-zone for conversion.
*
* @param dateString the input string to parse
* @return java.util.Date object
* @throws ParseException if parsing fails entirely
* @return The parsed Date
* @throws IOException if parsing fails.
*/
public static Date parseDate(final String dateString) throws IOException {
final OffsetDateTime dateTime = parseOffsetDateTime(dateString, true);

View File

@ -69,7 +69,7 @@ public class RESTApiRequest {
/**
* Sets the request body as a raw String.
*
* @param body The raw string body.
* @param body The raw string body.
* @param contentType The content type of the request body.
* @return The updated RESTApiRequest instance.
*/
@ -83,8 +83,7 @@ public class RESTApiRequest {
/**
* Sets the request body as a raw String.
*
* @param body The raw string body (consider as "text/plain").
* @param contentType The content type of the request body.
* @param body The raw string body (consider as "text/plain").
* @return The updated RESTApiRequest instance.
*/
public <TYPE_BODY> RESTApiRequest bodyString(final String body) {
@ -136,11 +135,10 @@ public class RESTApiRequest {
}
/**
* Sed data as a json body.
* Set data as a json body.
*
* @param body a serialized Json object.
* @return The updated RESTApiRequest instance.
* @throws JsonProcessingException If serialization fails.
*/
public <TYPE_BODY> RESTApiRequest bodyAsJson(final String body) {
this.serializedBodyString = body;
@ -316,11 +314,11 @@ public class RESTApiRequest {
*
* <p>This method encodes each key and value using UTF-8 encoding to ensure that
* the resulting query string is safe for use in a URL. The encoded key-value pairs
* are then joined together with '&' separators.</p>
* are then joined together with `&amp;` separators.</p>
*
* @param params A map containing query parameter names and their corresponding values.
* Both keys and values will be URL-encoded.
* @return A URL-encoded query string (e.g., "name=John+Doe&age=30")
* @return A URL-encoded query string.
*/
public static String buildQueryParams(final Map<String, String> params) {
return params.entrySet().stream().map(entry -> URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8) + "="