org.codehaus.plexus.component.configurator.converters
Class AbstractConfigurationConverter

java.lang.Object
  extended by org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter
All Implemented Interfaces:
ConfigurationConverter
Direct Known Subclasses:
AbstractBasicConverter, ArrayConverter, ClassRealmConverter, CollectionConverter, MapConverter, ObjectWithFieldsConverter, PlexusConfigurationConverter, PropertiesConverter

public abstract class AbstractConfigurationConverter
extends java.lang.Object
implements ConfigurationConverter

Version:
$Id: AbstractConfigurationConverter.java 6097 2007-03-15 15:29:27Z olamy $
Author:
Michal Maczka

Constructor Summary
AbstractConfigurationConverter()
           
 
Method Summary
 java.lang.Object fromConfiguration(ConverterLookup converterLookup, PlexusConfiguration configuration, java.lang.Class type, java.lang.Class baseType, java.lang.ClassLoader classLoader, ExpressionEvaluator expressionEvaluator)
           
protected  java.lang.Object fromExpression(PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator)
           
protected  java.lang.Object fromExpression(PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator, java.lang.Class type)
           
protected  java.lang.String fromXML(java.lang.String elementName)
           
protected  java.lang.Class getClassForImplementationHint(java.lang.Class type, PlexusConfiguration configuration, java.lang.ClassLoader classLoader)
          We will check if user has provided a hint which class should be used for given field.
protected  java.lang.Object instantiateObject(java.lang.Class clazz)
           
protected  java.lang.Object instantiateObject(java.lang.String classname, java.lang.ClassLoader classLoader)
           
protected  java.lang.Class loadClass(java.lang.String classname, java.lang.ClassLoader classLoader)
           
protected  java.lang.String toXML(java.lang.String fieldName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.plexus.component.configurator.converters.ConfigurationConverter
canConvert, fromConfiguration
 

Constructor Detail

AbstractConfigurationConverter

public AbstractConfigurationConverter()
Method Detail

getClassForImplementationHint

protected java.lang.Class getClassForImplementationHint(java.lang.Class type,
                                                        PlexusConfiguration configuration,
                                                        java.lang.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 java.lang.Class loadClass(java.lang.String classname,
                                    java.lang.ClassLoader classLoader)
                             throws ComponentConfigurationException
Throws:
ComponentConfigurationException

instantiateObject

protected java.lang.Object instantiateObject(java.lang.String classname,
                                             java.lang.ClassLoader classLoader)
                                      throws ComponentConfigurationException
Throws:
ComponentConfigurationException

instantiateObject

protected java.lang.Object instantiateObject(java.lang.Class clazz)
                                      throws ComponentConfigurationException
Throws:
ComponentConfigurationException

fromXML

protected java.lang.String fromXML(java.lang.String elementName)

toXML

protected java.lang.String toXML(java.lang.String fieldName)

fromExpression

protected java.lang.Object fromExpression(PlexusConfiguration configuration,
                                          ExpressionEvaluator expressionEvaluator,
                                          java.lang.Class type)
                                   throws ComponentConfigurationException
Throws:
ComponentConfigurationException

fromExpression

protected java.lang.Object fromExpression(PlexusConfiguration configuration,
                                          ExpressionEvaluator expressionEvaluator)
                                   throws ComponentConfigurationException
Throws:
ComponentConfigurationException

fromConfiguration

public java.lang.Object fromConfiguration(ConverterLookup converterLookup,
                                          PlexusConfiguration configuration,
                                          java.lang.Class type,
                                          java.lang.Class baseType,
                                          java.lang.ClassLoader classLoader,
                                          ExpressionEvaluator expressionEvaluator)
                                   throws ComponentConfigurationException
Specified by:
fromConfiguration in interface ConfigurationConverter
Parameters:
converterLookup - Repository of available converters
type - the type of object to read
baseType - the type of object the the source is
classLoader - ClassLoader which should be used for loading classes
expressionEvaluator - the expression evaluator to use for expressions
Returns:
the object
Throws:
ComponentConfigurationException


Copyright © 2001-2008 Codehaus. All Rights Reserved.