Examples of JavaMappedProperty


Examples of org.apache.tuscany.spi.implementation.java.JavaMappedProperty

        if (CompositeContext.class.equals(paramType)) {
            String name = method.getName();
            if (name.startsWith("set")) {
                name = JavaIntrospectionHelper.toPropertyName(name);
            }
            JavaMappedProperty property = new JavaMappedProperty();
            property.setName(name);
            property.setMember(method);
            throw new UnsupportedOperationException();
            // TODO pass in composite context
            //SingletonObjectFactory factory = new SingletonObjectFactory(compositeContext);
            //property.setDefaultValueFactory(factory);
            //type.getProperties().put(name,property);
        } else if (RequestContext.class.equals(paramType)) {
            String name = method.getName();
            if (name.startsWith("set")) {
                name = JavaIntrospectionHelper.toPropertyName(name);
            }
            JavaMappedProperty property = new JavaMappedProperty();
            property.setName(name);
            property.setMember(method);
            throw new UnsupportedOperationException();
            // TODO pass in request context
            //property.setDefaultValueFactory(factory);
            //type.getProperties().put(name,property);
        } else {
View Full Code Here

Examples of org.apache.tuscany.spi.implementation.java.JavaMappedProperty

        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
        Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
        ConstructorDefinition<Foo> definition = new ConstructorDefinition<Foo>(ctor);
        type.setConstructorDefinition(definition);
        JavaMappedProperty property = new JavaMappedProperty();
        property.setName("myBar");
        definition.getInjectionNames().add("myBar");
        type.getProperties().put("myBar", property);
        processor.visitEnd(null, Foo.class, type, null);
        assertEquals(2, type.getProperties().size());
    }
View Full Code Here

Examples of org.apache.tuscany.spi.implementation.java.JavaMappedProperty

        Constructor<Foo2> ctor = Foo2.class.getConstructor(String.class, String.class, String.class);
        ConstructorDefinition<Foo2> definition = new ConstructorDefinition<Foo2>(ctor);
        type.setConstructorDefinition(definition);
        // insert placeholder for first param, which would be done by a processor
        definition.getInjectionNames().add("");
        JavaMappedProperty property = new JavaMappedProperty();
        property.setName("myBar");
        definition.getInjectionNames().add("myBar");
        type.getProperties().put("myBar", property);
        processor.visitEnd(null, Foo2.class, type, null);
        assertEquals("baz", definition.getInjectionNames().get(0));
        assertEquals(2, type.getProperties().size());
View Full Code Here

Examples of org.apache.tuscany.spi.implementation.java.JavaMappedProperty

        ref.setName("reference");
        type.add(ref);
        JavaMappedReference ref2 = new JavaMappedReference();
        ref2.setName("reference2");
        type.add(ref2);
        JavaMappedProperty<?> prop1 = new JavaMappedProperty();
        prop1.setName("string1");
        type.add(prop1);
        JavaMappedProperty<?> prop2 = new JavaMappedProperty();
        prop2.setName("string2");
        type.add(prop2);
        processor.visitEnd(null, ServiceImpl.class, type, null);
        assertEquals(1, type.getServices().size());
    }
View Full Code Here

Examples of org.apache.tuscany.spi.implementation.java.JavaMappedProperty

            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
        Constructor<Bar> ctor = Bar.class.getConstructor(String.class, BazMonitor.class);
        EasyMock.expect(monitorFactory.getMonitor(EasyMock.eq(BazMonitor.class))).andReturn(null);
        EasyMock.replay(monitorFactory);
        ConstructorDefinition<Bar> definition = new ConstructorDefinition<Bar>(ctor);
        JavaMappedProperty prop = new JavaMappedProperty();
        definition.getInjectionNames().add("prop");
        type.setConstructorDefinition(definition);
        type.getProperties().put("prop", prop);
        processor.visitConstructor(null, ctor, type, null);
        Map<String, JavaMappedProperty<?>> properties = type.getProperties();
View Full Code Here

Examples of org.apache.tuscany.spi.implementation.java.JavaMappedProperty

        assertNotNull(type.getProperties().get("foo"));
    }

    public void testMethodRequired() throws Exception {
        processor.visitMethod(null, Foo.class.getMethod("setFooRequired", String.class), type, null);
        JavaMappedProperty prop = type.getProperties().get("fooRequired");
        assertNotNull(prop);
        assertEquals(prop.getOverride(), MUST);
    }
View Full Code Here

Examples of org.apache.tuscany.spi.implementation.java.JavaMappedProperty

        assertNotNull(type.getProperties().get("baz"));
    }

    public void testFieldRequired() throws Exception {
        processor.visitField(null, Foo.class.getDeclaredField("bazRequired"), type, null);
        JavaMappedProperty prop = type.getProperties().get("bazRequired");
        assertNotNull(prop);
        assertEquals(prop.getOverride(), OverrideOptions.MUST);
    }
View Full Code Here

Examples of org.apache.tuscany.spi.implementation.java.JavaMappedProperty

        type.setInitMethod(initMethod);
        Method destroyMethod = FooImpl.class.getMethod("destroy");
        destroyMethod.setAccessible(true);
        type.setDestroyMethod(destroyMethod);
        type.setImplementationScope(Scope.MODULE);
        JavaMappedProperty mappedProp = new JavaMappedProperty();
        mappedProp.setName("prop");
        Method propMethod = FooImpl.class.getMethod("setProp", String.class);
        propMethod.setAccessible(true);
        mappedProp.setMember(propMethod);
        type.add(mappedProp);
        ConstructorDefinition<FooImpl> ctorDef = new ConstructorDefinition<FooImpl>(FooImpl.class.getConstructor());
        type.setConstructorDefinition(ctorDef);
        SystemImplementation impl = new SystemImplementation();
        impl.setComponentType(type);
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.