Package org.apache.camel.impl

Examples of org.apache.camel.impl.CachingInjector


        if (visitedClasses.contains(type)) {
            return;
        }
        visitedClasses.add(type);
        Method[] methods = type.getDeclaredMethods();
        CachingInjector injector = null;

        for (Method method : methods) {
            Converter annotation = method.getAnnotation(Converter.class);
            if (annotation != null) {
                Class<?>[] parameterTypes = method.getParameterTypes();
                if (parameterTypes == null || parameterTypes.length != 1) {
                    LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: " + method
                             + " as a converter method should have one parameter");
                } else {
                    int modifiers = method.getModifiers();
                    if (isAbstract(modifiers) || !isPublic(modifiers)) {
                        LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: " + method
                                 + " as a converter method is not a public and concrete method");
                    } else {
                        Class toType = method.getReturnType();
                        if (toType.equals(Void.class)) {
                            LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: "
                                     + method + " as a converter method returns a void method");
                        } else {
                            Class fromType = parameterTypes[0];
                            if (isStatic(modifiers)) {
                                registry.addTypeConverter(toType, fromType,
                                                          new StaticMethodTypeConverter(method));
                            } else {
                                if (injector == null) {
                                    injector = new CachingInjector(registry, type);
                                }
                                registry.addTypeConverter(toType, fromType,
                                                          new InstanceMethodTypeConverter(injector, method));
                            }
                        }
View Full Code Here


            return;
        }
        visitedClasses.add(type);
        try {
            Method[] methods = type.getDeclaredMethods();
            CachingInjector injector = null;

            for (Method method : methods) {
                Converter annotation = method.getAnnotation(Converter.class);
                if (annotation != null) {
                    Class<?>[] parameterTypes = method.getParameterTypes();
                    if (parameterTypes == null || parameterTypes.length != 1) {
                        LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: " + method
                                + " as a converter method should have one parameter");
                    } else {
                        int modifiers = method.getModifiers();
                        if (isAbstract(modifiers) || !isPublic(modifiers)) {
                            LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: " + method
                                    + " as a converter method is not a public and concrete method");
                        } else {
                            Class toType = method.getReturnType();
                            if (toType.equals(Void.class)) {
                                LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: "
                                        + method + " as a converter method returns a void method");
                            } else {
                                Class fromType = parameterTypes[0];
                                if (isStatic(modifiers)) {
                                    registerTypeConverter(registry, method, toType, fromType,
                                                          new StaticMethodTypeConverter(method));
                                } else {
                                    if (injector == null) {
                                        injector = new CachingInjector(registry, type);
                                    }
                                    registerTypeConverter(registry, method, toType, fromType,
                                            new InstanceMethodTypeConverter(injector, method));
                                }
                            }
View Full Code Here

        if (visitedClasses.contains(type)) {
            return;
        }
        visitedClasses.add(type);
        Method[] methods = type.getDeclaredMethods();
        CachingInjector injector = null;

        for (Method method : methods) {
            Converter annotation = method.getAnnotation(Converter.class);
            if (annotation != null) {
                Class<?>[] parameterTypes = method.getParameterTypes();
                if (parameterTypes == null || parameterTypes.length != 1) {
                    log.warn("Ignoring bad converter on type: " + type.getName()
                            + " method: " + method + " as a converter method should have one parameter");
                }
                else {
                    int modifiers = method.getModifiers();
                    if (isAbstract(modifiers) || !isPublic(modifiers)) {
                        log.warn("Ignoring bad converter on type: " + type.getName()
                                + " method: " + method + " as a converter method is not a public and concrete method");
                    }
                    else {
                        Class toType = method.getReturnType();
                        if (toType.equals(Void.class)) {
                            log.warn("Ignoring bad converter on type: " + type.getName()
                                    + " method: " + method + " as a converter method returns a void method");
                        }
                        else {
                            Class fromType = parameterTypes[0];
                            if (isStatic(modifiers)) {
                                registry.addTypeConverter(toType, fromType, new StaticMethodTypeConverter(method));
                            }
                            else {
                                if (injector == null) {
                                    injector = new CachingInjector(registry, type);
                                }
                                registry.addTypeConverter(toType, fromType, new InstanceMethodTypeConverter(injector, method));
                            }
                        }
                    }
View Full Code Here

            return;
        }
        visitedClasses.add(type);
        try {
            Method[] methods = type.getDeclaredMethods();
            CachingInjector injector = null;

            for (Method method : methods) {
                Converter annotation = method.getAnnotation(Converter.class);
                if (annotation != null) {
                    Class<?>[] parameterTypes = method.getParameterTypes();
                    if (parameterTypes == null || parameterTypes.length != 1) {
                        LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: " + method
                                + " as a converter method should have one parameter");
                    }
                    else {
                        int modifiers = method.getModifiers();
                        if (isAbstract(modifiers) || !isPublic(modifiers)) {
                            LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: " + method
                                    + " as a converter method is not a public and concrete method");
                        }
                        else {
                            Class toType = method.getReturnType();
                            if (toType.equals(Void.class)) {
                                LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: "
                                        + method + " as a converter method returns a void method");
                            }
                            else {
                                Class fromType = parameterTypes[0];
                                if (isStatic(modifiers)) {
                                  registerTypeConverter(registry, method, toType, fromType,
                                            new StaticMethodTypeConverter(method));
                                }
                                else {
                                    if (injector == null) {
                                        injector = new CachingInjector(registry, type);
                                    }
                                    registerTypeConverter(registry, method, toType, fromType,
                                            new InstanceMethodTypeConverter(injector, method));
                                }
                            }
View Full Code Here

TOP

Related Classes of org.apache.camel.impl.CachingInjector

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.