Class RhinoConfig

java.lang.Object
org.mozilla.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);
  • 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.