- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.boolex.PropertyConditionBase
-
- ch.qos.logback.core.boolex.IsPropertyDefinedCondition
-
- All Implemented Interfaces:
PropertyCondition,Condition,ContextAware,LifeCycle
public class IsPropertyDefinedCondition extends PropertyConditionBase
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). Whenevaluate()is called it returnstrueif the named property is defined andfalseotherwise.
-
-
Field Summary
-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description IsPropertyDefinedCondition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanevaluate()Evaluate whether the configured property is defined.StringgetKey()Return the configured property name (key) that this evaluator will test for definition.voidsetKey(String key)Set the property name (key) to be checked by this evaluator.voidstart()Start the evaluator.-
Methods inherited from class ch.qos.logback.core.boolex.PropertyConditionBase
getLocalPropertyContainer, isDefined, isNull, isStarted, p, property, propertyContains, propertyEquals, setLocalPropertyContainer, stop
-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
-
-
-
Constructor Detail
-
IsPropertyDefinedCondition
public IsPropertyDefinedCondition()
-
-
Method Detail
-
start
public void start()
Start the evaluator. If the requiredkeyis not set an error is reported and startup is aborted.- Specified by:
startin interfaceLifeCycle- Overrides:
startin classPropertyConditionBase
-
getKey
public String getKey()
Return the configured property name (key) that this evaluator will test for definition.- Returns:
- the property key, or
nullif 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 benull
-
evaluate
public boolean evaluate()
Evaluate whether the configured property is defined.- Returns:
trueif the property named bykeyis defined,falseotherwise
-
-