Package org.apache.camel

Examples of org.apache.camel.PropertyInject


        protected void injectFields(final Object bean, final String beanName) {
            Class<?> clazz = bean.getClass();
            do {
                Field[] fields = clazz.getDeclaredFields();
                for (Field field : fields) {
                    PropertyInject propertyInject = field.getAnnotation(PropertyInject.class);
                    if (propertyInject != null && matchContext(propertyInject.context())) {
                        injectFieldProperty(field, propertyInject.value(), propertyInject.defaultValue(), bean, beanName);
                    }

                    EndpointInject endpointInject = field.getAnnotation(EndpointInject.class);
                    if (endpointInject != null && matchContext(endpointInject.context())) {
                        injectField(field, endpointInject.uri(), endpointInject.ref(), endpointInject.property(), bean, beanName);
View Full Code Here


                clazz = clazz.getSuperclass();
            } while (clazz != null && clazz != Object.class);
        }

        protected void setterInjection(Method method, Object bean, String beanName) {
            PropertyInject propertyInject = method.getAnnotation(PropertyInject.class);
            if (propertyInject != null && matchContext(propertyInject.context())) {
                setterPropertyInjection(method, propertyInject.value(), propertyInject.defaultValue(), bean, beanName);
            }

            EndpointInject endpointInject = method.getAnnotation(EndpointInject.class);
            if (endpointInject != null && matchContext(endpointInject.context())) {
                setterInjection(method, bean, beanName, endpointInject.uri(), endpointInject.ref(), endpointInject.property());
View Full Code Here

        protected void injectFields(final Object bean, final String beanName) {
            Class<?> clazz = bean.getClass();
            do {
                Field[] fields = clazz.getDeclaredFields();
                for (Field field : fields) {
                    PropertyInject propertyInject = field.getAnnotation(PropertyInject.class);
                    if (propertyInject != null && matchContext(propertyInject.context())) {
                        injectFieldProperty(field, propertyInject.value(), propertyInject.defaultValue(), bean, beanName);
                    }

                    BeanInject beanInject = field.getAnnotation(BeanInject.class);
                    if (beanInject != null && matchContext(beanInject.context())) {
                        injectFieldBean(field, beanInject.value(), bean, beanName);
View Full Code Here

                clazz = clazz.getSuperclass();
            } while (clazz != null && clazz != Object.class);
        }

        protected void setterInjection(Method method, Object bean, String beanName) {
            PropertyInject propertyInject = method.getAnnotation(PropertyInject.class);
            if (propertyInject != null && matchContext(propertyInject.context())) {
                setterPropertyInjection(method, propertyInject.value(), propertyInject.defaultValue(), bean, beanName);
            }

            BeanInject beanInject = method.getAnnotation(BeanInject.class);
            if (beanInject != null && matchContext(beanInject.context())) {
                setterBeanInjection(method, beanInject.value(), bean, beanName);
View Full Code Here

        protected void injectFields(final Object bean, final String beanName) {
            Class<?> clazz = bean.getClass();
            do {
                Field[] fields = clazz.getDeclaredFields();
                for (Field field : fields) {
                    PropertyInject propertyInject = field.getAnnotation(PropertyInject.class);
                    if (propertyInject != null && matchContext(propertyInject.context())) {
                        injectFieldProperty(field, propertyInject.value(), propertyInject.defaultValue(), bean, beanName);
                    }

                    BeanInject beanInject = field.getAnnotation(BeanInject.class);
                    if (beanInject != null && matchContext(beanInject.context())) {
                        injectFieldBean(field, beanInject.value(), bean, beanName);
View Full Code Here

                clazz = clazz.getSuperclass();
            } while (clazz != null && clazz != Object.class);
        }

        protected void setterInjection(Method method, Object bean, String beanName) {
            PropertyInject propertyInject = method.getAnnotation(PropertyInject.class);
            if (propertyInject != null && matchContext(propertyInject.context())) {
                setterPropertyInjection(method, propertyInject.value(), propertyInject.defaultValue(), bean, beanName);
            }

            BeanInject beanInject = method.getAnnotation(BeanInject.class);
            if (beanInject != null && matchContext(beanInject.context())) {
                setterBeanInjection(method, beanInject.value(), bean, beanName);
View Full Code Here

        CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);

        MyPropertyFieldBean bean = new MyPropertyFieldBean();

        Field field = bean.getClass().getField("timeout");
        PropertyInject propertyInject = field.getAnnotation(PropertyInject.class);
        Class<?> type = field.getType();
        Object value = helper.getInjectionPropertyValue(type, propertyInject.value(), "", "timeout",  bean, "foo");
        assertEquals(Integer.valueOf("2000"), Integer.valueOf("" + value));

        field = bean.getClass().getField("greeting");
        propertyInject = field.getAnnotation(PropertyInject.class);
        type = field.getType();
        value = helper.getInjectionPropertyValue(type, propertyInject.value(), "", "greeting",  bean, "foo");
        assertEquals("Hello Camel", value);
    }
View Full Code Here

        CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);

        MyPropertyFieldBean bean = new MyPropertyFieldBean();

        Field field = bean.getClass().getField("timeout");
        PropertyInject propertyInject = field.getAnnotation(PropertyInject.class);
        Class<?> type = field.getType();
        Object value = helper.getInjectionPropertyValue(type, propertyInject.value(), "5000", "timeout",  bean, "foo");
        assertEquals(Integer.valueOf("5000"), Integer.valueOf("" + value));

        field = bean.getClass().getField("greeting");
        propertyInject = field.getAnnotation(PropertyInject.class);
        type = field.getType();
        value = helper.getInjectionPropertyValue(type, propertyInject.value(), "", "greeting",  bean, "foo");
        assertEquals("Hello Camel", value);
    }
View Full Code Here

        CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);

        MyPropertyMethodBean bean = new MyPropertyMethodBean();

        Method method = bean.getClass().getMethod("setTimeout", int.class);
        PropertyInject propertyInject = method.getAnnotation(PropertyInject.class);
        Class<?> type = method.getParameterTypes()[0];
        Object value = helper.getInjectionPropertyValue(type, propertyInject.value(), "", "timeout",  bean, "foo");
        assertEquals(Integer.valueOf("2000"), Integer.valueOf("" + value));

        method = bean.getClass().getMethod("setGreeting", String.class);
        propertyInject = method.getAnnotation(PropertyInject.class);
        type = method.getParameterTypes()[0];
        value = helper.getInjectionPropertyValue(type, propertyInject.value(), "", "greeting",  bean, "foo");
        assertEquals("Hello Camel", value);
    }
View Full Code Here

     * @param bean the bean to be injected
     */
    protected void injectFields(final Object bean, final String beanName) {
        ReflectionHelper.doWithFields(bean.getClass(), new ReflectionHelper.FieldCallback() {
            public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
                PropertyInject propertyInject = field.getAnnotation(PropertyInject.class);
                if (propertyInject != null && getPostProcessorHelper().matchContext(propertyInject.context())) {
                    injectFieldProperty(field, propertyInject.value(), propertyInject.defaultValue(), bean, beanName);
                }

                BeanInject beanInject = field.getAnnotation(BeanInject.class);
                if (beanInject != null && getPostProcessorHelper().matchContext(beanInject.context())) {
                    injectFieldBean(field, beanInject.value(), bean, beanName);
View Full Code Here

TOP

Related Classes of org.apache.camel.PropertyInject

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.