Examples of ConstructorArg


Examples of com.alibaba.citrus.springext.util.SpringExtUtil.ConstructorArg

    @Test
    public void createConstructorArg_BeanFactory() throws Exception {
        BeanFactory context = createMock(BeanFactory.class);

        // not ApplicationContext or ConfigurableBeanFactory, required
        ConstructorArg arg = new ConstructorArg(MyClass.class.getConstructors()[0], HttpServletRequest.class, 0, true);
        arg.setBeanFactory(context);

        try {
            arg.getObject();
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("could not get object of " + HttpServletRequest.class.getName()
                                    + ": no Application Context"));
        }

        // not ApplicationContext or ConfigurableBeanFactory, optional
        arg = new ConstructorArg(MyClass.class.getConstructors()[0], HttpServletRequest.class, 0, false);
        arg.setBeanFactory(context);
        assertNull(arg.getObject());
    }
View Full Code Here

Examples of com.alibaba.citrus.springext.util.SpringExtUtil.ConstructorArg

    @Test
    public void createConstructorArg_BeanFactory() throws Exception {
        BeanFactory context = createMock(BeanFactory.class);

        // not ApplicationContext or ConfigurableBeanFactory, required
        ConstructorArg arg = new ConstructorArg(MyClass.class.getConstructors()[0], HttpServletRequest.class, 0, true);
        arg.setBeanFactory(context);

        try {
            arg.getObject();
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("could not get object of " + HttpServletRequest.class.getName()
                                    + ": no Application Context"));
        }

        // not ApplicationContext or ConfigurableBeanFactory, optional
        arg = new ConstructorArg(MyClass.class.getConstructors()[0], HttpServletRequest.class, 0, false);
        arg.setBeanFactory(context);
        assertNull(arg.getObject());
    }
View Full Code Here

Examples of org.springmodules.xt.model.generator.annotation.ConstructorArg

    private Object putConstructorArg(final Object[] args, final Method method) {
        if (args.length != 1) {
            throw new IllegalStateException("The setter method " + method.getName() + " must have only one argument!");
        } else {
            String name = StringUtils.uncapitalize(method.getName().substring(3));
            ConstructorArg annotation = method.getAnnotation(ConstructorArg.class);
            int position = annotation.position();
            Class type = null;
            if (method.isAnnotationPresent(ConstructorArgType.class)) {
                type = method.getAnnotation(ConstructorArgType.class).type();
            } else {
                type = args[0].getClass();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.