/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.ehcache;

import java.util.Map;

import org.apache.camel.CamelContext;
import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
import org.apache.camel.spi.PropertyConfigurerGetter;
import org.apache.camel.spi.ConfigurerStrategy;
import org.apache.camel.spi.GeneratedPropertyConfigurer;
import org.apache.camel.util.CaseInsensitiveMap;
import org.apache.camel.support.component.PropertyConfigurerSupport;

/**
 * Generated by camel build tools - do NOT edit this file!
 */
@SuppressWarnings("unchecked")
public class EhcacheComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {

    private org.apache.camel.component.ehcache.EhcacheConfiguration getOrCreateConfiguration(EhcacheComponent target) {
        if (target.getConfiguration() == null) {
            target.setConfiguration(new org.apache.camel.component.ehcache.EhcacheConfiguration());
        }
        return target.getConfiguration();
    }

    @Override
    public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
        EhcacheComponent target = (EhcacheComponent) obj;
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "action": getOrCreateConfiguration(target).setAction(property(camelContext, java.lang.String.class, value)); return true;
        case "autowiredenabled":
        case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true;
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
        case "cachemanager":
        case "cacheManager": getOrCreateConfiguration(target).setCacheManager(property(camelContext, org.ehcache.CacheManager.class, value)); return true;
        case "cachemanagerconfiguration":
        case "cacheManagerConfiguration": getOrCreateConfiguration(target).setCacheManagerConfiguration(property(camelContext, org.ehcache.config.Configuration.class, value)); return true;
        case "configuration": getOrCreateConfiguration(target).setConfiguration(property(camelContext, org.ehcache.config.CacheConfiguration.class, value)); return true;
        case "configurationuri":
        case "configurationUri": getOrCreateConfiguration(target).setConfigurationUri(property(camelContext, java.lang.String.class, value)); return true;
        case "configurations": getOrCreateConfiguration(target).setConfigurations(property(camelContext, java.util.Map.class, value)); return true;
        case "createcacheifnotexist":
        case "createCacheIfNotExist": getOrCreateConfiguration(target).setCreateCacheIfNotExist(property(camelContext, boolean.class, value)); return true;
        case "eventfiring":
        case "eventFiring": getOrCreateConfiguration(target).setEventFiring(property(camelContext, org.ehcache.event.EventFiring.class, value)); return true;
        case "eventordering":
        case "eventOrdering": getOrCreateConfiguration(target).setEventOrdering(property(camelContext, org.ehcache.event.EventOrdering.class, value)); return true;
        case "eventtypes":
        case "eventTypes": getOrCreateConfiguration(target).setEventTypes(property(camelContext, java.lang.String.class, value)); return true;
        case "key": getOrCreateConfiguration(target).setKey(property(camelContext, java.lang.Object.class, value)); return true;
        case "keytype":
        case "keyType": getOrCreateConfiguration(target).setKeyType(property(camelContext, java.lang.String.class, value)); return true;
        case "lazystartproducer":
        case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
        case "valuetype":
        case "valueType": getOrCreateConfiguration(target).setValueType(property(camelContext, java.lang.String.class, value)); return true;
        default: return false;
        }
    }

    @Override
    public Class<?> getOptionType(String name, boolean ignoreCase) {
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "action": return java.lang.String.class;
        case "autowiredenabled":
        case "autowiredEnabled": return boolean.class;
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": return boolean.class;
        case "cachemanager":
        case "cacheManager": return org.ehcache.CacheManager.class;
        case "cachemanagerconfiguration":
        case "cacheManagerConfiguration": return org.ehcache.config.Configuration.class;
        case "configuration": return org.ehcache.config.CacheConfiguration.class;
        case "configurationuri":
        case "configurationUri": return java.lang.String.class;
        case "configurations": return java.util.Map.class;
        case "createcacheifnotexist":
        case "createCacheIfNotExist": return boolean.class;
        case "eventfiring":
        case "eventFiring": return org.ehcache.event.EventFiring.class;
        case "eventordering":
        case "eventOrdering": return org.ehcache.event.EventOrdering.class;
        case "eventtypes":
        case "eventTypes": return java.lang.String.class;
        case "key": return java.lang.Object.class;
        case "keytype":
        case "keyType": return java.lang.String.class;
        case "lazystartproducer":
        case "lazyStartProducer": return boolean.class;
        case "valuetype":
        case "valueType": return java.lang.String.class;
        default: return null;
        }
    }

    @Override
    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
        EhcacheComponent target = (EhcacheComponent) obj;
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "action": return getOrCreateConfiguration(target).getAction();
        case "autowiredenabled":
        case "autowiredEnabled": return target.isAutowiredEnabled();
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": return target.isBridgeErrorHandler();
        case "cachemanager":
        case "cacheManager": return getOrCreateConfiguration(target).getCacheManager();
        case "cachemanagerconfiguration":
        case "cacheManagerConfiguration": return getOrCreateConfiguration(target).getCacheManagerConfiguration();
        case "configuration": return getOrCreateConfiguration(target).getConfiguration();
        case "configurationuri":
        case "configurationUri": return getOrCreateConfiguration(target).getConfigurationUri();
        case "configurations": return getOrCreateConfiguration(target).getConfigurations();
        case "createcacheifnotexist":
        case "createCacheIfNotExist": return getOrCreateConfiguration(target).isCreateCacheIfNotExist();
        case "eventfiring":
        case "eventFiring": return getOrCreateConfiguration(target).getEventFiring();
        case "eventordering":
        case "eventOrdering": return getOrCreateConfiguration(target).getEventOrdering();
        case "eventtypes":
        case "eventTypes": return getOrCreateConfiguration(target).getEventTypes();
        case "key": return getOrCreateConfiguration(target).getKey();
        case "keytype":
        case "keyType": return getOrCreateConfiguration(target).getKeyType();
        case "lazystartproducer":
        case "lazyStartProducer": return target.isLazyStartProducer();
        case "valuetype":
        case "valueType": return getOrCreateConfiguration(target).getValueType();
        default: return null;
        }
    }

    @Override
    public Object getCollectionValueType(Object target, String name, boolean ignoreCase) {
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "configurations": return org.ehcache.config.CacheConfiguration.class;
        default: return null;
        }
    }
}

