Class IsPropertyDefinedCondition

All Implemented Interfaces:
PropertyCondition, Condition, ContextAware, LifeCycle

Checks whether a named property is defined in the context (e.g. system properties, environment, or the configured property map used by the surrounding framework).

This condition expects a property name to be provided via setKey(String). When evaluate() is called it returns true if the named property is defined and false otherwise.

  • Constructor Details

  • Method Details

    • start

      public void start()
      Start the evaluator. If the required key is not set an error is reported and startup is aborted.
      Specified by:
      start in interface LifeCycle
      Overrides:
      start in class PropertyConditionBase
    • getKey

      public String getKey()
      Return the configured property name (key) that this evaluator will test for definition.
      Returns:
      the property key, or null if not set
    • setKey

      public void setKey(String key)
      Set the property name (key) to be checked by this evaluator.
      Parameters:
      key - the property name to check; must not be null
    • evaluate

      public boolean evaluate()
      Evaluate whether the configured property is defined.
      Returns:
      true if the property named by key is defined, false otherwise