Package org.eclipse.sisu.plexus
Class CompositeBeanHelper
- java.lang.Object
-
- org.eclipse.sisu.plexus.CompositeBeanHelper
-
public final class CompositeBeanHelper extends java.lang.ObjectHelper class that implements low-level Plexus configuration of composite beans.
-
-
Field Summary
Fields Modifier and Type Field Description private ExpressionEvaluatorevaluatorprivate ConfigurationListenerlistenerprivate java.lang.ClassLoaderloaderprivate ConverterLookuplookupprivate static java.lang.reflect.Type[]NO_TYPES
-
Constructor Summary
Constructors Constructor Description CompositeBeanHelper(ConverterLookup lookup, java.lang.ClassLoader loader, ExpressionEvaluator evaluator, ConfigurationListener listener)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.ObjectconvertProperty(java.lang.Class<?> beanType, java.lang.Class<?> rawPropertyType, java.lang.reflect.Type genericPropertyType, PlexusConfiguration configuration)private static java.lang.reflect.TypeexpandType(java.lang.reflect.Type type)private static java.lang.reflect.FieldfindField(java.lang.Class<?> beanType, java.lang.String fieldName)private static java.lang.reflect.MethodfindMethod(java.lang.Class<?> beanType, java.lang.reflect.Type[] paramTypeHolder, java.lang.String methodName)private static java.lang.reflect.Type[]getTypeArguments(java.lang.reflect.Type type)voidsetDefault(java.lang.Object bean, java.lang.Object defaultValue, PlexusConfiguration configuration)Calls the default "set" method on the bean; re-converts the configuration if necessary.private static voidsetField(java.lang.Object bean, java.lang.reflect.Field field, java.lang.Object value)voidsetProperty(java.lang.Object bean, java.lang.String propertyName, java.lang.Class<?> valueType, PlexusConfiguration configuration)Sets a property in the bean; looks for public setter/adder method before checking fields.
-
-
-
Field Detail
-
NO_TYPES
private static final java.lang.reflect.Type[] NO_TYPES
-
lookup
private final ConverterLookup lookup
-
loader
private final java.lang.ClassLoader loader
-
evaluator
private final ExpressionEvaluator evaluator
-
listener
private final ConfigurationListener listener
-
-
Constructor Detail
-
CompositeBeanHelper
public CompositeBeanHelper(ConverterLookup lookup, java.lang.ClassLoader loader, ExpressionEvaluator evaluator, ConfigurationListener listener)
-
-
Method Detail
-
setDefault
public void setDefault(java.lang.Object bean, java.lang.Object defaultValue, PlexusConfiguration configuration) throws ComponentConfigurationExceptionCalls the default "set" method on the bean; re-converts the configuration if necessary.- Parameters:
bean- The bean being configureddefaultValue- The default valueconfiguration- The configuration- Throws:
ComponentConfigurationException
-
setProperty
public void setProperty(java.lang.Object bean, java.lang.String propertyName, java.lang.Class<?> valueType, PlexusConfiguration configuration) throws ComponentConfigurationExceptionSets a property in the bean; looks for public setter/adder method before checking fields.- Parameters:
bean- The bean being configuredpropertyName- The property namevalueType- The value typeconfiguration- The configuration- Throws:
ComponentConfigurationException
-
convertProperty
private java.lang.Object convertProperty(java.lang.Class<?> beanType, java.lang.Class<?> rawPropertyType, java.lang.reflect.Type genericPropertyType, PlexusConfiguration configuration) throws ComponentConfigurationException- Throws:
ComponentConfigurationException
-
getTypeArguments
private static java.lang.reflect.Type[] getTypeArguments(java.lang.reflect.Type type)
-
expandType
private static java.lang.reflect.Type expandType(java.lang.reflect.Type type)
-
findMethod
private static java.lang.reflect.Method findMethod(java.lang.Class<?> beanType, java.lang.reflect.Type[] paramTypeHolder, java.lang.String methodName)
-
findField
private static java.lang.reflect.Field findField(java.lang.Class<?> beanType, java.lang.String fieldName)
-
setField
private static void setField(java.lang.Object bean, java.lang.reflect.Field field, java.lang.Object value) throws java.lang.Exception- Throws:
java.lang.Exception
-
-