Package org.eclipse.sisu.plexus
Class CompositeBeanHelper
java.lang.Object
org.eclipse.sisu.plexus.CompositeBeanHelper
Helper class that implements low-level Plexus configuration of composite beans.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ExpressionEvaluatorprivate final ConfigurationListenerprivate final ClassLoaderprivate final ConverterLookupprivate static final Type[] -
Constructor Summary
ConstructorsConstructorDescriptionCompositeBeanHelper(ConverterLookup lookup, ClassLoader loader, ExpressionEvaluator evaluator, ConfigurationListener listener) -
Method Summary
Modifier and TypeMethodDescriptionprivate ObjectconvertProperty(Class<?> beanType, Class<?> rawPropertyType, Type genericPropertyType, PlexusConfiguration configuration) private static TypeexpandType(Type type) private static Fieldprivate static MethodfindMethod(Class<?> beanType, Type[] paramTypeHolder, String methodName) private static Type[]getTypeArguments(Type type) voidsetDefault(Object bean, Object defaultValue, PlexusConfiguration configuration) Calls the default "set" method on the bean; re-converts the configuration if necessary.private static voidvoidsetProperty(Object bean, String propertyName, Class<?> valueType, PlexusConfiguration configuration) Sets a property in the bean; looks for public setter/adder method before checking fields.
-
Field Details
-
NO_TYPES
-
lookup
-
loader
-
evaluator
-
listener
-
-
Constructor Details
-
CompositeBeanHelper
public CompositeBeanHelper(ConverterLookup lookup, ClassLoader loader, ExpressionEvaluator evaluator, ConfigurationListener listener)
-
-
Method Details
-
setDefault
public void setDefault(Object bean, Object defaultValue, PlexusConfiguration configuration) throws ComponentConfigurationException Calls 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(Object bean, String propertyName, Class<?> valueType, PlexusConfiguration configuration) throws ComponentConfigurationException Sets 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 Object convertProperty(Class<?> beanType, Class<?> rawPropertyType, Type genericPropertyType, PlexusConfiguration configuration) throws ComponentConfigurationException - Throws:
ComponentConfigurationException
-
getTypeArguments
-
expandType
-
findMethod
-
findField
-
setField
- Throws:
Exception
-