- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.boolex.PropertyConditionBase
-
- ch.qos.logback.core.boolex.PropertyEqualityCondition
-
- All Implemented Interfaces:
PropertyCondition,Condition,ContextAware,LifeCycle
public class PropertyEqualityCondition extends PropertyConditionBase
Condition that evaluates totruewhen a property equals a specified expected value.The property named by
keyis resolved using the inherited property lookup mechanism (seePropertyConditionBase). If the resolved property value equalsvalue(usingString.equals(Object)), this condition evaluates totrue.- Since:
- 1.5.20
-
-
Field Summary
-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description PropertyEqualityCondition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanevaluate()Evaluate the condition: resolve the property named bykeyand compare it tovalue.StringgetKey()Return the property key that will be looked up when evaluating the condition.StringgetValue()Return the configured expected value.voidsetKey(String key)Set the property key to resolve during evaluation.voidsetValue(String value)Set the expected value that the resolved property must equal for this condition to evaluate totrue.voidstart()Start the component and validate required parameters.-
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
-
PropertyEqualityCondition
public PropertyEqualityCondition()
-
-
Method Detail
-
start
public void start()
Start the component and validate required parameters. If eitherkeyorvalueisnull, an error is reported and the component does not start.- Specified by:
startin interfaceLifeCycle- Overrides:
startin classPropertyConditionBase
-
getValue
public String getValue()
Return the configured expected value.- Returns:
- the expected value, or
nullif not set
-
setValue
public void setValue(String value)
Set the expected value that the resolved property must equal for this condition to evaluate totrue.- Parameters:
value- the expected value
-
getKey
public String getKey()
Return the property key that will be looked up when evaluating the condition.- Returns:
- the property key, or
nullif not set
-
setKey
public void setKey(String key)
Set the property key to resolve during evaluation.- Parameters:
key- the property key
-
evaluate
public boolean evaluate()
Evaluate the condition: resolve the property named bykeyand compare it tovalue.- Returns:
trueif the resolved property equals the expected value;falseotherwise
-
-