Class Property
- java.lang.Object
-
- org.apache.logging.log4j.core.config.Property
-
@Plugin(name="property", category="Core", printObject=true) public final class Property extends java.lang.Object
Represents a key/value pair in the configuration.
-
-
Field Summary
Fields Modifier and Type Field Description static Property[]EMPTY_ARRAYprivate static LoggerLOGGERprivate java.lang.Stringnameprivate java.lang.StringrawValueprivate java.lang.Stringvalueprivate booleanvalueNeedsLookup
-
Constructor Summary
Constructors Modifier Constructor Description privateProperty(java.lang.String name, java.lang.String rawValue, java.lang.String value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PropertycreateProperty(java.lang.String name, java.lang.String value)Creates a Property.static PropertycreateProperty(java.lang.String name, java.lang.String rawValue, java.lang.String value)Creates a Property.static PropertycreateProperty(java.lang.String name, java.lang.String rawValue, Configuration configuration)Creates a Property.java.lang.Stringevaluate(StrSubstitutor substitutor)Evaluate this property with the provided substitutor.java.lang.StringgetName()Returns the property name.java.lang.StringgetRawValue()Returns the original raw property value without substitution.java.lang.StringgetValue()Returns the property value.booleanisValueNeedsLookup()Returnstrueif the value contains a substitutable property that requires a lookup to be resolved.java.lang.StringtoString()
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final Property[] EMPTY_ARRAY
- Since:
- 2.11.2
-
LOGGER
private static final Logger LOGGER
-
name
private final java.lang.String name
-
rawValue
private final java.lang.String rawValue
-
value
private final java.lang.String value
-
valueNeedsLookup
private final boolean valueNeedsLookup
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the property name.- Returns:
- the property name.
-
getRawValue
public java.lang.String 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
public java.lang.String getValue()
Returns the property value.- Returns:
- the value of the property.
-
isValueNeedsLookup
public boolean isValueNeedsLookup()
Returnstrueif the value contains a substitutable property that requires a lookup to be resolved.- Returns:
trueif the value contains {@code "${"}, {@code false} otherwise
-
evaluate
public java.lang.String evaluate(StrSubstitutor substitutor)
Evaluate this property with the provided substitutor. IfisValueNeedsLookup()isfalse, thevalueis returned, otherwise theraw valueis evaluated with the given substitutor.
-
createProperty
public static Property createProperty(java.lang.String name, java.lang.String value)
Creates a Property.- Parameters:
name- The key.value- The value.- Returns:
- A Property.
-
createProperty
public static Property createProperty(java.lang.String name, java.lang.String rawValue, java.lang.String value)
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") java.lang.String name, @PluginValue(value="value",substitute=false) java.lang.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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-