[FIX] doc generation
This commit is contained in:
parent
69f69a8113
commit
37629b4cb2
@ -1,7 +1,6 @@
|
|||||||
package org.kar.archidata.tools;
|
package org.kar.archidata.tools;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
@ -39,6 +38,15 @@ public class DateTools {
|
|||||||
return parseOffsetDateTime(dateString, false);
|
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)
|
public static OffsetDateTime parseOffsetDateTime(final String dateString, final boolean missingAsUTC)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (dateString == null) {
|
if (dateString == null) {
|
||||||
@ -66,11 +74,11 @@ public class DateTools {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a flexible date string and returns a java.util.Date,
|
* 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
|
* @param dateString the input string to parse
|
||||||
* @return java.util.Date object
|
* @return The parsed Date
|
||||||
* @throws ParseException if parsing fails entirely
|
* @throws IOException if parsing fails.
|
||||||
*/
|
*/
|
||||||
public static Date parseDate(final String dateString) throws IOException {
|
public static Date parseDate(final String dateString) throws IOException {
|
||||||
final OffsetDateTime dateTime = parseOffsetDateTime(dateString, true);
|
final OffsetDateTime dateTime = parseOffsetDateTime(dateString, true);
|
||||||
|
@ -84,7 +84,6 @@ public class RESTApiRequest {
|
|||||||
* Sets the request body as a raw String.
|
* Sets the request body as a raw String.
|
||||||
*
|
*
|
||||||
* @param body The raw string body (consider as "text/plain").
|
* @param body The raw string body (consider as "text/plain").
|
||||||
* @param contentType The content type of the request body.
|
|
||||||
* @return The updated RESTApiRequest instance.
|
* @return The updated RESTApiRequest instance.
|
||||||
*/
|
*/
|
||||||
public <TYPE_BODY> RESTApiRequest bodyString(final String body) {
|
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.
|
* @param body a serialized Json object.
|
||||||
* @return The updated RESTApiRequest instance.
|
* @return The updated RESTApiRequest instance.
|
||||||
* @throws JsonProcessingException If serialization fails.
|
|
||||||
*/
|
*/
|
||||||
public <TYPE_BODY> RESTApiRequest bodyAsJson(final String body) {
|
public <TYPE_BODY> RESTApiRequest bodyAsJson(final String body) {
|
||||||
this.serializedBodyString = 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
|
* <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
|
* 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 `&` separators.</p>
|
||||||
*
|
*
|
||||||
* @param params A map containing query parameter names and their corresponding values.
|
* @param params A map containing query parameter names and their corresponding values.
|
||||||
* Both keys and values will be URL-encoded.
|
* 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) {
|
public static String buildQueryParams(final Map<String, String> params) {
|
||||||
return params.entrySet().stream().map(entry -> URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8) + "="
|
return params.entrySet().stream().map(entry -> URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8) + "="
|
||||||
|
Loading…
x
Reference in New Issue
Block a user