org.codehaus.plexus.component.configurator.converters
Class AbstractConfigurationConverter
java.lang.Object
org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter
- All Implemented Interfaces:
- ConfigurationConverter
- Direct Known Subclasses:
- AbstractBasicConverter, ArrayConverter, ClassRealmConverter, CollectionConverter, EnumConverter, MapConverter, ObjectWithFieldsConverter, PlexusConfigurationConverter, PropertiesConverter
public abstract class AbstractConfigurationConverter
- extends Object
- implements ConfigurationConverter
- Version:
- $Id: AbstractConfigurationConverter.java 7890 2008-11-29 17:14:01Z jvanzyl $
- Author:
- Michal Maczka
Method Summary |
protected void |
failIfNotTypeCompatible(Object value,
Class<?> type,
PlexusConfiguration configuration)
|
Object |
fromConfiguration(ConverterLookup converterLookup,
PlexusConfiguration configuration,
Class type,
Class baseType,
ClassLoader classLoader,
ExpressionEvaluator expressionEvaluator)
|
protected Object |
fromExpression(PlexusConfiguration configuration,
ExpressionEvaluator expressionEvaluator)
|
protected Object |
fromExpression(PlexusConfiguration configuration,
ExpressionEvaluator expressionEvaluator,
Class type)
|
protected String |
fromXML(String elementName)
|
protected Class |
getClassForImplementationHint(Class type,
PlexusConfiguration configuration,
ClassLoader classLoader)
We will check if user has provided a hint which class should be used for given field. |
protected Object |
instantiateObject(Class clazz)
|
protected Object |
instantiateObject(String classname,
ClassLoader classLoader)
|
protected Class |
loadClass(String classname,
ClassLoader classLoader)
|
protected String |
toXML(String fieldName)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractConfigurationConverter
public AbstractConfigurationConverter()
getClassForImplementationHint
protected Class getClassForImplementationHint(Class type,
PlexusConfiguration configuration,
ClassLoader classLoader)
throws ComponentConfigurationException
- We will check if user has provided a hint which class should be used for given field. So we will check if
something like is present in configuraion. If 'implementation' hint was provided
we will try to load correspoding class If we are unable to do so error will be reported
- Throws:
ComponentConfigurationException
loadClass
protected Class loadClass(String classname,
ClassLoader classLoader)
throws ComponentConfigurationException
- Throws:
ComponentConfigurationException
instantiateObject
protected Object instantiateObject(String classname,
ClassLoader classLoader)
throws ComponentConfigurationException
- Throws:
ComponentConfigurationException
instantiateObject
protected Object instantiateObject(Class clazz)
throws ComponentConfigurationException
- Throws:
ComponentConfigurationException
fromXML
protected String fromXML(String elementName)
toXML
protected String toXML(String fieldName)
failIfNotTypeCompatible
protected void failIfNotTypeCompatible(Object value,
Class<?> type,
PlexusConfiguration configuration)
throws ComponentConfigurationException
- Throws:
ComponentConfigurationException
fromExpression
protected Object fromExpression(PlexusConfiguration configuration,
ExpressionEvaluator expressionEvaluator,
Class type)
throws ComponentConfigurationException
- Throws:
ComponentConfigurationException
fromExpression
protected Object fromExpression(PlexusConfiguration configuration,
ExpressionEvaluator expressionEvaluator)
throws ComponentConfigurationException
- Throws:
ComponentConfigurationException
fromConfiguration
public Object fromConfiguration(ConverterLookup converterLookup,
PlexusConfiguration configuration,
Class type,
Class baseType,
ClassLoader classLoader,
ExpressionEvaluator expressionEvaluator)
throws ComponentConfigurationException
- Specified by:
fromConfiguration
in interface ConfigurationConverter
- Parameters:
converterLookup
- Repository of available converterstype
- the type of object to readbaseType
- the type of object the the source isclassLoader
- ClassLoader which should be used for loading classesexpressionEvaluator
- the expression evaluator to use for expressions
- Returns:
- the object
- Throws:
ComponentConfigurationException
Copyright © 2010-2012 Sonatype, Inc.. All Rights Reserved.