Class RhinoConfig

java.lang.Object
org.htmlunit.corejs.javascript.config.RhinoConfig

public class RhinoConfig extends Object
RhinoConfig provides typesafe and static access methods to a RhinoProperties default instance.

Note: Reading a config value only once is a good practice to avoid affecting performance. For example:

     private static final boolean XYZ_ENABLED = RhinoConfig.get("rhino.xyz.enabled", false);
 
Author:
Roland Praml, Foconis Analytics GmbH
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    get(String property)
    Returns the property as string with null as default.
    static boolean
    get(String property, boolean defaultValue)
    Returns the property as boolean.
    static int
    get(String property, int defaultValue)
    Returns the property as integer.
    static <T extends Enum<T>>
    T
    get(String property, T defaultValue)
    Returns the property as enum.

    Methods inherited from class java.lang.Object

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

    • RhinoConfig

      public RhinoConfig()
  • Method Details

    • get

      public static String get(String property)
      Returns the property as string with null as default.
    • get

      public static <T extends Enum<T>> T get(String property, T defaultValue)
      Returns the property as enum.

      If the property is set to any of the enum names (case-insensitive), this enum value is returned, otherwise defaultValue is returned.

      Note: defaultValue must be specified to derive the enum class and its values.

    • get

      public static boolean get(String property, boolean defaultValue)
      Returns the property as boolean.

      A property is true, if it is either Boolean.TRUE or if and only if the string representation is equal to "true" (case-insensitive). If the property is not set, defaultValue is returned

      Same behaviour as Boolean.getBoolean(String)

    • get

      public static int get(String property, int defaultValue)
      Returns the property as integer.

      if the property is not set or not a valid integer value, defaultValue is returned.