Class Util

java.lang.Object
xal.extension.application.Util

public class Util extends Object
Utility class providing convenience methods for use in the application framework.
Author:
tap
  • Constructor Details

    • Util

      protected Util()
      Creates a new instance of Util
  • Method Details

    • loadResourceBundle

      public static Map<String,String> loadResourceBundle(URL resourceURL) throws RuntimeException
      Load the resource bundle specified by the URL. When the resource bundle is loaded, the properties are stored in a Map for convenience data access.
      Parameters:
      resourceURL - The URL to the properties file
      Returns:
      The map equivalent of the resource bundle or null if the resource was not found
      Throws:
      RuntimeException
    • mergeResourceBundle

      public static void mergeResourceBundle(Map<String,String> map, URL source)
      Merge the resource bundle from the specified source into the specified map. If the file does not exist at the source, then nothing is merged as this is intended for optional modifications.
      Parameters:
      map - the map into which the resources should be merged
      source - URL to the resource to merge
    • getPropertiesForResource

      public static Map<String,String> getPropertiesForResource(String propertyFile)
      Convenience method for loading the resource bundle from a file whose path is specified relative to the application's resources folder.
      Parameters:
      propertyFile - The property file relative to the application's resources folder
      Returns:
      The map equivalent of the resource bundle
      Throws:
      MissingResourceException - If the resource bundle cannot be found.
      See Also:
    • getTokens

      protected static String[] getTokens(String string)
      Parse a string into tokens where whitespace is the delimiter.
      Parameters:
      string - The string to parse.
      Returns:
      The array of tokens.
    • getTokens

      protected static String[] getTokens(String string, String delim)
      Parse a string into tokens with the specified delimiter.
      Parameters:
      string - The string to parse.
      delim - The delimiter
      Returns:
      The array of tokens.