Renamed some static methods.
authorMarco Zanon <info@marcozanon.com>
Sun, 12 Nov 2023 11:02:16 +0000 (11:02 +0000)
committerMarco Zanon <info@marcozanon.com>
Sun, 12 Nov 2023 11:02:16 +0000 (11:02 +0000)
src/main/java/com/marcozanon/macaco/conversion/MDateConverter.java
src/main/java/com/marcozanon/macaco/conversion/MLocalDateConverter.java
src/main/java/com/marcozanon/macaco/conversion/MLocalDateTimeConverter.java
src/main/java/com/marcozanon/macaco/conversion/MNumberConverter.java

index 87b55a134b7885be71fbaec5b694716261565545..6c9894a8d30707f75d8cf21e1eb7ab4e2208db2f 100644 (file)
@@ -137,7 +137,7 @@ public class MDateConverter extends MObject {
         }
     }
 
-    protected static Date getDateFromStringByParameters(String x, String inputDateFormat, Locale inputLocale, TimeZone inputTimeZone) throws MInvalidConversionFormatException {
+    protected static Date createDateFromString(String x, String inputDateFormat, Locale inputLocale, TimeZone inputTimeZone) throws MInvalidConversionFormatException {
         if (MText.isBlank(x)) {
             throw new IllegalArgumentException("Invalid 'x': null or empty.");
         }
@@ -180,7 +180,7 @@ public class MDateConverter extends MObject {
         return d2;
     }
 
-    protected static String getStringFromDateByParameters(Date date, String outputDateFormat, Locale outputLocale, TimeZone outputTimeZone) {
+    protected static String createStringFromDate(Date date, String outputDateFormat, Locale outputLocale, TimeZone outputTimeZone) {
         if (null == date) {
             throw new IllegalArgumentException("Invalid 'date': null.");
         }
@@ -198,11 +198,11 @@ public class MDateConverter extends MObject {
         return sdf.format(date);
     }
 
-    public Date getDateFromString(String x) throws MInvalidConversionFormatException {
+    public Date createDateFromString(String x) throws MInvalidConversionFormatException {
         Date y = null;
         for (String dateFormat: this.getDateFormats()) {
             try {
-                y = MDateConverter.getDateFromStringByParameters(x, dateFormat, this.getLocale(), this.getTimeZone());
+                y = MDateConverter.createDateFromString(x, dateFormat, this.getLocale(), this.getTimeZone());
                 //
                 return y;
             }
@@ -216,8 +216,8 @@ public class MDateConverter extends MObject {
         return y; // necessary to avoid Java compilation errors
     }
 
-    public String getStringFromDate(Date x) {
-        return MDateConverter.getStringFromDateByParameters(x, this.getDefaultDateFormat(), this.getLocale(), this.getTimeZone());
+    public String createStringFromDate(Date x) {
+        return MDateConverter.createStringFromDate(x, this.getDefaultDateFormat(), this.getLocale(), this.getTimeZone());
     }
 
     /* Helpers. */
index a9b7e4f9bbf7832b098c8fb2082025ee41e5b68f..78daf32a994451f69bf73e775e798589e881e4c5 100644 (file)
@@ -114,7 +114,7 @@ public class MLocalDateConverter extends MObject {
         }
     }
 
-    protected static LocalDate getDateFromStringByParameters(String x, String inputDateFormat, Locale inputLocale) throws MInvalidConversionFormatException {
+    protected static LocalDate createDateFromString(String x, String inputDateFormat, Locale inputLocale) throws MInvalidConversionFormatException {
         if (MText.isBlank(x)) {
             throw new IllegalArgumentException("Invalid 'x': null or empty.");
         }
@@ -134,7 +134,7 @@ public class MLocalDateConverter extends MObject {
         return d;
     }
 
-    protected static String getStringFromDateByParameters(LocalDate date, String outputDateFormat, Locale outputLocale) {
+    protected static String createStringFromDate(LocalDate date, String outputDateFormat, Locale outputLocale) {
         if (null == date) {
             throw new IllegalArgumentException("Invalid 'date': null.");
         }
@@ -146,11 +146,11 @@ public class MLocalDateConverter extends MObject {
         return date.format(DateTimeFormatter.ofPattern(outputDateFormat, outputLocale).withResolverStyle(ResolverStyle.STRICT));
     }
 
-    public LocalDate getDateFromString(String x) throws MInvalidConversionFormatException {
+    public LocalDate createDateFromString(String x) throws MInvalidConversionFormatException {
         LocalDate y = null;
         for (String dateFormat: this.getDateFormats()) {
             try {
-                y = MLocalDateConverter.getDateFromStringByParameters(x, dateFormat, this.getLocale());
+                y = MLocalDateConverter.createDateFromString(x, dateFormat, this.getLocale());
                 //
                 return y;
             }
@@ -164,8 +164,8 @@ public class MLocalDateConverter extends MObject {
         return y; // necessary to avoid Java compilation errors
     }
 
-    public String getStringFromDate(LocalDate x) {
-        return MLocalDateConverter.getStringFromDateByParameters(x, this.getDefaultDateFormat(), this.getLocale());
+    public String createStringFromDate(LocalDate x) {
+        return MLocalDateConverter.createStringFromDate(x, this.getDefaultDateFormat(), this.getLocale());
     }
 
 }
index 85b5d432583bd27fa736daad750f7a4e136e8d3a..7de5d71b26d6f0629dcfa055d9f4340380f7a192 100644 (file)
@@ -114,7 +114,7 @@ public class MLocalDateTimeConverter extends MObject {
         }
     }
 
-    protected static LocalDateTime getDatetimeFromStringByParameters(String x, String inputDatetimeFormat, Locale inputLocale) throws MInvalidConversionFormatException {
+    protected static LocalDateTime createDatetimeFromString(String x, String inputDatetimeFormat, Locale inputLocale) throws MInvalidConversionFormatException {
         if (MText.isBlank(x)) {
             throw new IllegalArgumentException("Invalid 'x': null or empty.");
         }
@@ -134,7 +134,7 @@ public class MLocalDateTimeConverter extends MObject {
         return dt;
     }
 
-    protected static String getStringFromDatetimeByParameters(LocalDateTime datetime, String outputDatetimeFormat, Locale outputLocale) {
+    protected static String createStringFromDatetime(LocalDateTime datetime, String outputDatetimeFormat, Locale outputLocale) {
         if (null == datetime) {
             throw new IllegalArgumentException("Invalid 'datetime': null.");
         }
@@ -146,11 +146,11 @@ public class MLocalDateTimeConverter extends MObject {
         return datetime.format(DateTimeFormatter.ofPattern(outputDatetimeFormat, outputLocale).withResolverStyle(ResolverStyle.STRICT));
     }
 
-    public LocalDateTime getDatetimeFromString(String x) throws MInvalidConversionFormatException {
+    public LocalDateTime createDatetimeFromString(String x) throws MInvalidConversionFormatException {
         LocalDateTime y = null;
         for (String datetimeFormat: this.getDatetimeFormats()) {
             try {
-                y = MLocalDateTimeConverter.getDatetimeFromStringByParameters(x, datetimeFormat, this.getLocale());
+                y = MLocalDateTimeConverter.createDatetimeFromString(x, datetimeFormat, this.getLocale());
                 //
                 return y;
             }
@@ -164,8 +164,8 @@ public class MLocalDateTimeConverter extends MObject {
         return y; // necessary to avoid Java compilation errors
     }
 
-    public String getStringFromDatetime(LocalDateTime x) {
-        return MLocalDateTimeConverter.getStringFromDatetimeByParameters(x, this.getDefaultDatetimeFormat(), this.getLocale());
+    public String createStringFromDatetime(LocalDateTime x) {
+        return MLocalDateTimeConverter.createStringFromDatetime(x, this.getDefaultDatetimeFormat(), this.getLocale());
     }
 
 }
index ae192d8db1628a9b3c4015da8089273f3f7a0e1f..1f885febf61b85bdaeef083b7eeca2a2555917f6 100644 (file)
@@ -115,7 +115,7 @@ public class MNumberConverter extends MObject {
         }
     }
 
-    protected static BigDecimal getNumberFromStringByParameters(String x, String inputNumberFormat, Locale inputLocale) throws MInvalidConversionFormatException {
+    protected static BigDecimal createNumberFromString(String x, String inputNumberFormat, Locale inputLocale) throws MInvalidConversionFormatException {
         if (MText.isBlank(x)) {
             throw new IllegalArgumentException("Invalid 'x': null or empty.");
         }
@@ -137,7 +137,7 @@ public class MNumberConverter extends MObject {
         return bd;
     }
 
-    protected static String getStringFromNumberByParameters(BigDecimal number, String outputNumberFormat, Locale outputLocale) {
+    protected static String createStringFromNumber(BigDecimal number, String outputNumberFormat, Locale outputLocale) {
         if (null == number) {
             throw new IllegalArgumentException("Invalid 'number': null.");
         }
@@ -153,11 +153,11 @@ public class MNumberConverter extends MObject {
         return df.format(number);
     }
 
-    public BigDecimal getNumberFromString(String x) throws MInvalidConversionFormatException {
+    public BigDecimal createNumberFromString(String x) throws MInvalidConversionFormatException {
         BigDecimal y = null;
         for (String numberFormat: this.getNumberFormats()) {
             try {
-                y = MNumberConverter.getNumberFromStringByParameters(x, numberFormat, this.getLocale());
+                y = MNumberConverter.createNumberFromString(x, numberFormat, this.getLocale());
                 //
                 return y;
             }
@@ -171,8 +171,8 @@ public class MNumberConverter extends MObject {
         return y; // necessary to avoid Java compilation errors
     }
 
-    public String getStringFromNumber(BigDecimal x) {
-        return MNumberConverter.getStringFromNumberByParameters(x, this.getDefaultNumberFormat(), this.getLocale());
+    public String createStringFromNumber(BigDecimal x) {
+        return MNumberConverter.createStringFromNumber(x, this.getDefaultNumberFormat(), this.getLocale());
     }
 
 }