Package org.jboss.logmanager.config
Class AbstractPropertyConfiguration<T,C extends AbstractPropertyConfiguration<T,C>>
- java.lang.Object
-
- org.jboss.logmanager.config.AbstractBasicConfiguration<T,C>
-
- org.jboss.logmanager.config.AbstractPropertyConfiguration<T,C>
-
- All Implemented Interfaces:
NamedConfigurable
,ObjectConfigurable
,PropertyConfigurable
- Direct Known Subclasses:
ErrorManagerConfigurationImpl
,FilterConfigurationImpl
,FormatterConfigurationImpl
,HandlerConfigurationImpl
,PojoConfigurationImpl
abstract class AbstractPropertyConfiguration<T,C extends AbstractPropertyConfiguration<T,C>> extends AbstractBasicConfiguration<T,C> implements ObjectConfigurable, PropertyConfigurable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
AbstractPropertyConfiguration.ConstructAction
(package private) static class
AbstractPropertyConfiguration.ModuleFinder
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<? extends T>
actualClass
private java.lang.String
className
private java.lang.String[]
constructorProperties
private java.lang.String
moduleName
private java.util.Map<java.lang.String,java.lang.reflect.Method>
postConfigurationMethods
private java.util.Map<java.lang.String,ValueExpression<java.lang.String>>
properties
-
Fields inherited from class org.jboss.logmanager.config.AbstractBasicConfiguration
configs, refs
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPropertyConfiguration(java.lang.Class<T> baseClass, LogContextConfigurationImpl configuration, java.util.Map<java.lang.String,T> refs, java.util.Map<java.lang.String,C> configs, java.lang.String name, java.lang.String moduleName, java.lang.String className, java.lang.String[] constructorProperties)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addPostConfigurationActions()
private void
addPostConfigurationActions(boolean replace)
boolean
addPostConfigurationMethod(java.lang.String methodName)
Adds a method name to be invoked after all properties have been set.(package private) static boolean
contains(java.lang.Object[] array, java.lang.Object val)
(package private) java.lang.Class<? extends T>
getActualClass()
java.lang.String
getClassName()
Get the class name for this object's configuration.(package private) ConfigAction<T>
getConstructAction()
java.util.List<java.lang.String>
getConstructorProperties()
Returns a collection of the constructor properties.(package private) static java.lang.Class<?>
getConstructorPropertyType(java.lang.Class<?> clazz, java.lang.String propertyName)
(package private) abstract java.lang.String
getDescription()
java.lang.String
getModuleName()
Get the module name for this object's configuration, if any.java.util.List<java.lang.String>
getPostConfigurationMethods()
Returns a collection of the methods to be invoked after the properties have been set.(package private) static java.lang.reflect.Method
getPropertyGetter(java.lang.Class<?> clazz, java.lang.String propertyName)
java.util.List<java.lang.String>
getPropertyNames()
Get the names of the configured properties in order.(package private) static java.lang.reflect.Method
getPropertySetter(java.lang.Class<?> clazz, java.lang.String propertyName)
(package private) static java.lang.Class<?>
getPropertyType(java.lang.Class<?> clazz, java.lang.String propertyName)
ValueExpression<java.lang.String>
getPropertyValueExpression(java.lang.String propertyName)
Get the property value.java.lang.String
getPropertyValueString(java.lang.String propertyName)
Get the string property value with the given name.boolean
hasConstructorProperty(java.lang.String propertyName)
Determine whether the given property name is a constructor property.boolean
hasProperty(java.lang.String propertyName)
Determine whether the given property name is configured.protected java.util.Deque<?>
removePostConfigurationActions()
boolean
removePostConfigurationMethod(java.lang.String methodName)
Removes the post configuration method.boolean
removeProperty(java.lang.String propertyName)
Remove a configured property.void
setPostConfigurationMethods(java.lang.String... methodNames)
Sets the method names to be invoked after the properties have been set.void
setPostConfigurationMethods(java.util.List<java.lang.String> methodNames)
Sets the method names to be invoked after the properties have been set.void
setPropertyValueExpression(java.lang.String propertyName, java.lang.String expression)
Sets the expression value for the property.void
setPropertyValueExpression(java.lang.String propertyName, java.lang.String expression, java.lang.String value)
Sets the expression value for the property.private void
setPropertyValueExpression(java.lang.String propertyName, ValueExpression<java.lang.String> expression)
void
setPropertyValueString(java.lang.String propertyName, java.lang.String value)
Set a property value from a string.-
Methods inherited from class org.jboss.logmanager.config.AbstractBasicConfiguration
clearRemoved, getConfigs, getConfiguration, getName, getRefs, getRemoveAction, isRemoved, setRemoved
-
-
-
-
Field Detail
-
actualClass
private final java.lang.Class<? extends T> actualClass
-
moduleName
private final java.lang.String moduleName
-
className
private final java.lang.String className
-
constructorProperties
private final java.lang.String[] constructorProperties
-
properties
private final java.util.Map<java.lang.String,ValueExpression<java.lang.String>> properties
-
postConfigurationMethods
private final java.util.Map<java.lang.String,java.lang.reflect.Method> postConfigurationMethods
-
-
Constructor Detail
-
AbstractPropertyConfiguration
protected AbstractPropertyConfiguration(java.lang.Class<T> baseClass, LogContextConfigurationImpl configuration, java.util.Map<java.lang.String,T> refs, java.util.Map<java.lang.String,C> configs, java.lang.String name, java.lang.String moduleName, java.lang.String className, java.lang.String[] constructorProperties)
-
-
Method Detail
-
getConstructAction
ConfigAction<T> getConstructAction()
-
getDescription
abstract java.lang.String getDescription()
-
getModuleName
public java.lang.String getModuleName()
Description copied from interface:ObjectConfigurable
Get the module name for this object's configuration, if any. If JBoss Modules is not present on the class path, onlynull
values are accepted.- Specified by:
getModuleName
in interfaceObjectConfigurable
- Returns:
- the module name, or
null
if none is configured
-
getClassName
public java.lang.String getClassName()
Description copied from interface:ObjectConfigurable
Get the class name for this object's configuration.- Specified by:
getClassName
in interfaceObjectConfigurable
- Returns:
- the class name
-
contains
static boolean contains(java.lang.Object[] array, java.lang.Object val)
-
setPropertyValueString
public void setPropertyValueString(java.lang.String propertyName, java.lang.String value) throws java.lang.IllegalArgumentException
Description copied from interface:PropertyConfigurable
Set a property value from a string.- Specified by:
setPropertyValueString
in interfacePropertyConfigurable
- Parameters:
propertyName
- the property namevalue
- the property value- Throws:
java.lang.IllegalArgumentException
- if the given value is not acceptable for this property
-
getPropertyValueString
public java.lang.String getPropertyValueString(java.lang.String propertyName)
Description copied from interface:PropertyConfigurable
Get the string property value with the given name.- Specified by:
getPropertyValueString
in interfacePropertyConfigurable
- Parameters:
propertyName
- the property name- Returns:
- the property value string
-
getPropertyValueExpression
public ValueExpression<java.lang.String> getPropertyValueExpression(java.lang.String propertyName)
Description copied from interface:PropertyConfigurable
Get the property value.- Specified by:
getPropertyValueExpression
in interfacePropertyConfigurable
- Parameters:
propertyName
- the property name- Returns:
- the property value
-
setPropertyValueExpression
public void setPropertyValueExpression(java.lang.String propertyName, java.lang.String expression)
Description copied from interface:PropertyConfigurable
Sets the expression value for the property.- Specified by:
setPropertyValueExpression
in interfacePropertyConfigurable
- Parameters:
propertyName
- the name of the propertyexpression
- the expression used to resolve the value
-
setPropertyValueExpression
public void setPropertyValueExpression(java.lang.String propertyName, java.lang.String expression, java.lang.String value)
Description copied from interface:PropertyConfigurable
Sets the expression value for the property. This method will not parse the expression for the value and instead use thevalue
parameter for the value.- Specified by:
setPropertyValueExpression
in interfacePropertyConfigurable
- Parameters:
propertyName
- the name of the propertyexpression
- the expression used to resolve the valuevalue
- the value to use
-
setPropertyValueExpression
private void setPropertyValueExpression(java.lang.String propertyName, ValueExpression<java.lang.String> expression)
-
hasProperty
public boolean hasProperty(java.lang.String propertyName)
Description copied from interface:PropertyConfigurable
Determine whether the given property name is configured.- Specified by:
hasProperty
in interfacePropertyConfigurable
- Parameters:
propertyName
- the property name to test- Returns:
true
if the name is configured,false
otherwise
-
removeProperty
public boolean removeProperty(java.lang.String propertyName)
Description copied from interface:PropertyConfigurable
Remove a configured property. Does not affect the underlying configured value; just removes it from the configuration.- Specified by:
removeProperty
in interfacePropertyConfigurable
- Parameters:
propertyName
- the property name- Returns:
true
if the property name was removed,false
if it was not present
-
getPropertyNames
public java.util.List<java.lang.String> getPropertyNames()
Description copied from interface:PropertyConfigurable
Get the names of the configured properties in order.- Specified by:
getPropertyNames
in interfacePropertyConfigurable
- Returns:
- the property names
-
hasConstructorProperty
public boolean hasConstructorProperty(java.lang.String propertyName)
Description copied from interface:PropertyConfigurable
Determine whether the given property name is a constructor property.- Specified by:
hasConstructorProperty
in interfacePropertyConfigurable
- Parameters:
propertyName
- the name of the property to check.- Returns:
true
if the property should be used as a construction property, otherwisefalse
.
-
getActualClass
java.lang.Class<? extends T> getActualClass()
-
getConstructorProperties
public java.util.List<java.lang.String> getConstructorProperties()
Description copied from interface:PropertyConfigurable
Returns a collection of the constructor properties.- Specified by:
getConstructorProperties
in interfacePropertyConfigurable
- Returns:
- a collection of the constructor properties.
-
addPostConfigurationMethod
public boolean addPostConfigurationMethod(java.lang.String methodName)
Description copied from interface:PropertyConfigurable
Adds a method name to be invoked after all properties have been set.- Specified by:
addPostConfigurationMethod
in interfacePropertyConfigurable
- Parameters:
methodName
- the name of the method- Returns:
true
if the method was successfully added, otherwisefalse
-
getPostConfigurationMethods
public java.util.List<java.lang.String> getPostConfigurationMethods()
Description copied from interface:PropertyConfigurable
Returns a collection of the methods to be invoked after the properties have been set.- Specified by:
getPostConfigurationMethods
in interfacePropertyConfigurable
- Returns:
- a collection of method names or an empty list
-
setPostConfigurationMethods
public void setPostConfigurationMethods(java.lang.String... methodNames)
Description copied from interface:PropertyConfigurable
Sets the method names to be invoked after the properties have been set.- Specified by:
setPostConfigurationMethods
in interfacePropertyConfigurable
- Parameters:
methodNames
- the method names to invoke
-
setPostConfigurationMethods
public void setPostConfigurationMethods(java.util.List<java.lang.String> methodNames)
Description copied from interface:PropertyConfigurable
Sets the method names to be invoked after the properties have been set.- Specified by:
setPostConfigurationMethods
in interfacePropertyConfigurable
- Parameters:
methodNames
- the method names to invoke
-
removePostConfigurationMethod
public boolean removePostConfigurationMethod(java.lang.String methodName)
Description copied from interface:PropertyConfigurable
Removes the post configuration method.- Specified by:
removePostConfigurationMethod
in interfacePropertyConfigurable
- Parameters:
methodName
- the method to remove- Returns:
true
if the method was removed, otherwisefalse
-
addPostConfigurationActions
protected final void addPostConfigurationActions()
-
addPostConfigurationActions
private void addPostConfigurationActions(boolean replace)
-
removePostConfigurationActions
protected final java.util.Deque<?> removePostConfigurationActions()
-
getPropertyType
static java.lang.Class<?> getPropertyType(java.lang.Class<?> clazz, java.lang.String propertyName)
-
getConstructorPropertyType
static java.lang.Class<?> getConstructorPropertyType(java.lang.Class<?> clazz, java.lang.String propertyName)
-
getPropertySetter
static java.lang.reflect.Method getPropertySetter(java.lang.Class<?> clazz, java.lang.String propertyName)
-
getPropertyGetter
static java.lang.reflect.Method getPropertyGetter(java.lang.Class<?> clazz, java.lang.String propertyName)
-
-