Class DefaultingVar

Direct Known Subclasses:
ArgsVar, ConfigVar, EnvVariablesVar, FileVar, ManifestFileVar, MapVar, ServletInitParamVar

public abstract class DefaultingVar extends SimpleVar
Interface for the resolution of vars with a default value if the resolve() method returns null.

For example, to resolve the system property "myProperty" but resolve to "not found" if the property doesn't exist: "$S{myProperty,not found}"

Subclasses must implement the following method:

See Also:
  • Constructor Details

    • DefaultingVar

      public DefaultingVar(String name)
      Constructor.
      Parameters:
      name - The name of this variable.
  • Method Details

    • doResolve

      public String doResolve(VarResolverSession session, String s) throws Exception
      Description copied from class: Var
      The method called from VarResolver.

      Can be overridden to intercept the request and do special handling.
      Default implementation simply calls resolve(String).

      Overrides:
      doResolve in class Var
      Parameters:
      session - The session object used for a single instance of a string resolution.
      s - The inside argument of the variable.
      Returns:
      The resolved value.
      Throws:
      Exception - Any exception can be thrown.