- All Implemented Interfaces:
PropertyCondition,Condition,ContextAware,LifeCycle
- Direct Known Subclasses:
IsPropertyDefinedCondition,IsPropertyNullCondition,PropertyEqualityCondition
Abstract base class provides some scaffolding. It is intended to ease migration from legacy conditional processing in configuration files (e.g. <if>, <then>, <else>) using the Janino library. Nevertheless, it should also be useful in newly written code.
Properties are looked up in the following order:
- In the local property container, usually the
ModelInterpretationContext - in the logger context
- system properties
- environment variables
- Since:
- 1.5.20
- Author:
- Ceki Gülcü
- See Also:
-
Field Summary
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the local property container used by this evaluator.booleanChecks if the property with the given key is defined (not null).booleanChecks if the property with the given key is null.booleanChecks if this evaluator has been started.Retrieves the property value for the given key, returning an empty string if null.Retrieves the property value for the given key, returning an empty string if null.voidsetLocalPropertyContainer(PropertyContainer aLocalPropertyContainer) Sets the local property container for this evaluator.voidstart()Starts this evaluator.voidstop()Stops this evaluator.Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Constructor Details
-
PropertyConditionBase
public PropertyConditionBase()
-
-
Method Details
-
getLocalPropertyContainer
Returns the local property container used by this evaluator.Local properties correspond to the properties in the embedding configurator, i.e. usually the
ModelInterpretationContextinstance.- Specified by:
getLocalPropertyContainerin interfacePropertyCondition- Returns:
- the local property container
-
setLocalPropertyContainer
Sets the local property container for this evaluator.Local properties correspond to the properties in the embedding configurator, i.e. usually the
ModelInterpretationContextinstance.- Specified by:
setLocalPropertyContainerin interfacePropertyCondition- Parameters:
aLocalPropertyContainer- the local property container to set
-
isNull
Checks if the property with the given key is null.The property is looked up via the
OptionHelper.propertyLookup(String, PropertyContainer, PropertyContainer)method. See above for the lookup order.- Parameters:
k- the property key- Returns:
- true if the property is null, false otherwise
-
isDefined
Checks if the property with the given key is defined (not null).The property is looked up via the
OptionHelper.propertyLookup(String, PropertyContainer, PropertyContainer)method. See above for the lookup order.- Parameters:
k- the property key- Returns:
- true if the property is defined, false otherwise
-
p
Retrieves the property value for the given key, returning an empty string if null. This is a shorthand forproperty(String).- Parameters:
k- the property key- Returns:
- the property value or an empty string
-
property
Retrieves the property value for the given key, returning an empty string if null.The property is looked up via the
OptionHelper.propertyLookup(String, PropertyContainer, PropertyContainer)method. See above for the lookup order.- Parameters:
k- the property key- Returns:
- the property value or an empty string
-
isStarted
Checks if this evaluator has been started. -
start
Starts this evaluator. -
stop
Stops this evaluator.
-