Class Utils


  • public class Utils
    extends java.lang.Object
    A collection of utilities for this package.
    Since:
    2.4.1
    Author:
    tomyeh
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String checkUpdateURI​(java.lang.String updateURI, java.lang.String info)
      Checks the update URI.
      static int get2DigitYearStart()
      Returns the start year only for the format using "yy" pattern, change the parse result in the 100 years span after that year. 2DigitYearStart should not be negative.
      static int getFirstDayOfWeek()
      Returns the first day of the week, or -1 if no defined by the application.
      static int getFirstDayOfWeek​(Session sess)
      Returns the first day of the week of the given session, or -1 if no defined by the application.
      static void updateDebugJS​(WebApp wapp, boolean debug)
      Update the status of debug-js.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • updateDebugJS

        public static void updateDebugJS​(WebApp wapp,
                                         boolean debug)
        Update the status of debug-js. It is called by Configuration.setDebugJS(boolean) to change the loading of JavaScript files dynamically.
        Since:
        5.0.3
      • getFirstDayOfWeek

        public static final int getFirstDayOfWeek()
        Returns the first day of the week, or -1 if no defined by the application. It is the same as getFirstDayOfWeek(Sessions.getCurrent()).
        Since:
        5.0.3
      • get2DigitYearStart

        public static final int get2DigitYearStart()
                                            throws java.lang.NumberFormatException
        Returns the start year only for the format using "yy" pattern, change the parse result in the 100 years span after that year. 2DigitYearStart should not be negative. for example, start year 1950 will parse [0-49] : 2000-2049 and [50-99] : 1950-1999

        Default: 1929

        Library property: Attributes.PREFERRED_2DIGITYEARSTART

        Throws:
        java.lang.NumberFormatException
        Since:
        8.6.2
      • checkUpdateURI

        public static final java.lang.String checkUpdateURI​(java.lang.String updateURI,
                                                            java.lang.String info)
                                                     throws javax.servlet.ServletException
        Checks the update URI.
        Parameters:
        updateURI - the update URI to be checked.
        info - the info to show if updateURI is incorrect.
        Returns:
        the update URI (by removing ending / if any)
        Throws:
        javax.servlet.ServletException - if updateURI is incorrect.
        Since:
        5.0.5