Package org.codehaus.plexus.component.configurator.converters

Examples of org.codehaus.plexus.component.configurator.converters.ConfigurationConverter


            ClassRealm cr = (ClassRealm) ReflectionUtils.invokeMethod( method, pd );
            cl = cr.getClassLoader();
        } else {
            cl = mojoExecution.getMojoDescriptor().getPluginDescriptor().getClassRealm();
        }
        ConfigurationConverter converter = converterLookup.lookupConverterForType(type);
        return type.cast(converter.fromConfiguration(converterLookup,child,type,
            // the implementation seems to expect the type of the bean for which the configuration is done
            // in this parameter, but we have no such type. So passing in a dummy
            Object.class,
            cl,
            expressionEvaluator));
View Full Code Here


                        throw new ComponentConfigurationException( "Error loading class '" + className + "'", e );
                    }
                }
            }

            ConfigurationConverter converter = converterLookup.lookupConverterForType( childType );

            Object object = converter.fromConfiguration( converterLookup, c, childType, baseType, classLoader,
                                                         expressionEvaluator, listener );

            Collection collection = (Collection) retValue;
            collection.add( object );
        }
View Full Code Here

            if ( childType == null )
            {
                childType = type.getComponentType();
            }

            ConfigurationConverter converter = converterLookup.lookupConverterForType( childType );

            Object object = converter.fromConfiguration( converterLookup, c, childType, baseType, classLoader,
                                                         expressionEvaluator, listener );

            values.add( object );
        }
View Full Code Here

    }

    public ConfigurationConverter lookupConverterForType( Class type )
        throws ComponentConfigurationException
    {
        ConfigurationConverter retValue = null;

        if ( converterMap.containsKey( type ) )
        {
            retValue = (ConfigurationConverter) converterMap.get( type );
        }
View Full Code Here

    private ConfigurationConverter findConverterForType( List converters, Class type )
    {
        for ( Iterator iterator = converters.iterator(); iterator.hasNext(); )
        {
            ConfigurationConverter converter = (ConfigurationConverter) iterator.next();

            if ( converter.canConvert( type ) )
            {
                converterMap.put( type, converter );

                return converter;
            }
View Full Code Here

        {
            setComponentStackProperty( child.getName() );
            try
            {
                ConverterLookup lookup = createConverterLookup();
                ConfigurationConverter converter = lookup.lookupConverterForType( toClass( expectedType ) );

                // todo this will not work for static factories
                ObjectRecipe caller = (ObjectRecipe) RecipeHelper.getCaller();
                Class parentClass = toClass( caller.getType() );

                Object value = converter.fromConfiguration(
                    lookup,
                    child,
                    toClass( expectedType ),
                    parentClass,
                    Thread.currentThread().getContextClassLoader(),
View Full Code Here

        @Override
        protected Object internalCreate(Type expectedType, boolean lazyRefAllowed) throws ConstructionException {
            try {
                ConverterLookup lookup = createConverterLookup();
                ConfigurationConverter converter = lookup.lookupConverterForType(toClass(expectedType));

                // todo this will not work for static factories
                ObjectRecipe caller = (ObjectRecipe) RecipeHelper.getCaller();
                Class parentClass = toClass(caller.getType());

                Object value = converter.fromConfiguration(lookup, child, toClass(expectedType), parentClass, Thread.currentThread().getContextClassLoader(), new DefaultExpressionEvaluator());
                return value;
            } catch (ComponentConfigurationException e) {
                throw new ConstructionException("Unable to convert configuration for property " + child.getName() + " to " + toClass(expectedType).getName());
            }
        }
View Full Code Here

    }

    public ConfigurationConverter lookupConverterForType( Class<?> type )
        throws ComponentConfigurationException
    {
        ConfigurationConverter retValue = null;

        if ( converterMap.containsKey( type ) )
        {
            retValue = converterMap.get( type );
        }
View Full Code Here

        @Override
        protected Object internalCreate(Type expectedType, boolean lazyRefAllowed) throws ConstructionException {
            try {
                ConverterLookup lookup = createConverterLookup();
                ConfigurationConverter converter = lookup.lookupConverterForType(toClass(expectedType));

                // todo this will not work for static factories
                ObjectRecipe caller = (ObjectRecipe) RecipeHelper.getCaller();
                Class parentClass = toClass(caller.getType());

                Object value = converter.fromConfiguration(lookup, child, toClass(expectedType), parentClass, Thread.currentThread().getContextClassLoader(), new DefaultExpressionEvaluator());
                return value;
            } catch (ComponentConfigurationException e) {
                throw new ConstructionException("Unable to convert configuration for property " + child.getName() + " to " + toClass(expectedType).getName());
            }
        }
View Full Code Here

                        throw new ComponentConfigurationException( "Error loading class '" + className + "'", e );
                    }
                }
            }

            ConfigurationConverter converter = converterLookup.lookupConverterForType( childType );

            Object object = converter.fromConfiguration( converterLookup, c, childType, baseType, classLoader,
                                                         expressionEvaluator, listener );

            Collection collection = (Collection) retValue;
            collection.add( object );
        }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.component.configurator.converters.ConfigurationConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.