]> git.mxchange.org Git - jcoreee.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 22 Jan 2023 03:04:26 +0000 (04:04 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 22 Jan 2023 03:04:26 +0000 (04:04 +0100)
- fixed some misuse of valueOf()/parse<Foo>() methods which fixes some flaws
  the inspector from Netbeans IDE has found
- no need to compare Boolean.parseBoolean() with Boolean.TRUE, just return it
  directly without comparison

src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java
src/org/mxchange/jcoreee/dates/DayOfTheWeek.java

index be104a1f60cb77b72d082235436936d5793bb8d8..48dd2ebb81c60aed326879750e6edbddb67e5819 100644 (file)
@@ -87,7 +87,7 @@ public abstract class BaseFacesBean implements Serializable {
         * @param locale Locale
         * <p>
         * @return Whether price ({@code value}) is at least {@code filter}
-        *
+        * <p>
         * @see https://www.primefaces.org/showcase/ui/data/datatable/filter.xhtml
         */
        @SuppressWarnings ("unchecked")
@@ -111,7 +111,7 @@ public abstract class BaseFacesBean implements Serializable {
                }
 
                // Do the cast and compare
-               return ((Comparable<BigDecimal>) value).compareTo(BigDecimal.valueOf(Double.valueOf(filterText))) >= 0;
+               return ((Comparable<BigDecimal>) value).compareTo(BigDecimal.valueOf(Double.parseDouble(filterText))) >= 0;
        }
 
        /**
@@ -155,7 +155,7 @@ public abstract class BaseFacesBean implements Serializable {
                }
 
                // Get context parameter
-               final Integer contextValue = Integer.parseInt(this.getStringContextParameter(parameterKey));
+               final Integer contextValue = Integer.valueOf(this.getStringContextParameter(parameterKey));
 
                // Return it
                return contextValue;
@@ -263,7 +263,7 @@ public abstract class BaseFacesBean implements Serializable {
                final String contextParameter = this.getStringContextParameter(String.format("is_debug_%s_enabled", controllerName)); //NOI18N
 
                // Return it
-               return (Boolean.parseBoolean(contextParameter) == Boolean.TRUE);
+               return Boolean.parseBoolean(contextParameter);
        }
 
        /**
index d546c7b6e4f3a3dd25ebd8f0f590b6464fcbdb47..a3e764cf45c7ceb4739ce2af0a618670b73263c8 100644 (file)
@@ -28,6 +28,9 @@ import java.util.GregorianCalendar;
  * @author Roland Häder<roland@mxchange.org>
  */
 public enum DayOfTheWeek {
+       /**
+        * Enumeration for Sunday
+        */
        SUNDAY {
                @Override
                public int toCalendar () {
@@ -35,36 +38,54 @@ public enum DayOfTheWeek {
                }
 
        },
+       /**
+        * Enumeration for Monday
+        */
        MONDAY {
                @Override
                public int toCalendar () {
                        return Calendar.MONDAY;
                }
        },
+       /**
+        * Enumeration for Tuesay
+        */
        TUESDAY {
                @Override
                public int toCalendar () {
                        return Calendar.TUESDAY;
                }
        },
+       /**
+        * Enumeration for Wednesday
+        */
        WEDNESDAY {
                @Override
                public int toCalendar () {
                        return Calendar.WEDNESDAY;
                }
        },
+       /**
+        * Enumeration for Thursday
+        */
        THURSDAY {
                @Override
                public int toCalendar () {
                        return Calendar.THURSDAY;
                }
        },
+       /**
+        * Enumeration for Friday
+        */
        FRIDAY {
                @Override
                public int toCalendar () {
                        return Calendar.FRIDAY;
                }
        },
+       /**
+        * Enumeration for Saturday
+        */
        SATURDAY {
                @Override
                public int toCalendar () {
@@ -85,6 +106,11 @@ public enum DayOfTheWeek {
                SIMPLE_DATE_FORMAT.applyPattern("EEEEEEEEEE"); //NOI18N
        }
 
+       /**
+        * Returns index from enumeration
+        * <p>
+        * @return Index of enumeration
+        */
        public abstract int toCalendar ();
 
        /**
@@ -99,11 +125,11 @@ public enum DayOfTheWeek {
                DayOfTheWeek dayOfTheWeek = null;
 
                // Walk through all values
-               for (final DayOfTheWeek dayOfWeek : DayOfTheWeek.values()) {
+               for (final DayOfTheWeek currentDayOfTheWeek : DayOfTheWeek.values()) {
                        // Has the day being found?
-                       if (dayOfWeek.toCalendar() == day) {
+                       if (currentDayOfTheWeek.toCalendar() == day) {
                                // Found it and break out from lopp
-                               dayOfTheWeek = dayOfWeek;
+                               dayOfTheWeek = currentDayOfTheWeek;
                                break;
                        }
                }
@@ -136,9 +162,6 @@ public enum DayOfTheWeek {
                return fromCalendarDay(calendar.get(Calendar.DAY_OF_WEEK));
        }
 
-       /*
-        * Should return the localized day of the week
-        */
        @Override
        public String toString () {
                // Init calendar