Class Property
java.lang.Object
org.apache.logging.log4j.core.config.Property
@Plugin(name="property",
category="Core",
printObject=true)
public final class Property
extends Object
Represents a key/value pair in the configuration.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Property
createProperty
(String name, String value) Creates a Property.static Property
createProperty
(String name, String rawValue, String value) Creates a Property.static Property
createProperty
(String name, String rawValue, Configuration configuration) Creates a Property.evaluate
(StrSubstitutor substitutor) Evaluate this property with the provided substitutor.getName()
Returns the property name.Returns the original raw property value without substitution.getValue()
Returns the property value.boolean
Returnstrue
if the value contains a substitutable property that requires a lookup to be resolved.toString()
-
Field Details
-
EMPTY_ARRAY
- Since:
- 2.11.2
-
-
Method Details
-
getName
Returns the property name.- Returns:
- the property name.
-
getRawValue
Returns the original raw property value without substitution.- Returns:
- the raw value of the property, or empty string if it is not set.
-
getValue
Returns the property value.- Returns:
- the value of the property.
-
isValueNeedsLookup
public boolean isValueNeedsLookup()Returnstrue
if the value contains a substitutable property that requires a lookup to be resolved.- Returns:
true
if the value contains"${}"
,false
otherwise
-
evaluate
Evaluate this property with the provided substitutor. IfisValueNeedsLookup()
isfalse
, thevalue
is returned, otherwise theraw value
is evaluated with the given substitutor. -
createProperty
Creates a Property.- Parameters:
name
- The key.value
- The value.- Returns:
- A Property.
-
createProperty
Creates a Property.- Parameters:
name
- The key.rawValue
- The value without any substitution applied.value
- The value.- Returns:
- A Property.
-
createProperty
@PluginFactory public static Property createProperty(@PluginAttribute("name") String name, @PluginValue(value="value",substitute=false) String rawValue, @PluginConfiguration Configuration configuration) Creates a Property.- Parameters:
name
- The key.rawValue
- The value without any substitution applied.configuration
- configuration used to resolve the property value from the rawValue- Returns:
- A Property.
-
toString
-