Examples of JavaResourceImpl


Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

    }

    public void testVisitMethod() throws Exception {
        Method method = Foo.class.getMethod("setBar", Bar.class);
        processor.visitMethod(method, type);
        JavaResourceImpl resource = type.getResources().get("bar");
        assertFalse(resource.isOptional());
        assertNull(resource.getMappedName());
        assertEquals(method.getParameterTypes()[0], resource.getElement().getType());
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

    }

    public void testVisitNamedMethod() throws Exception {
        Method method = Foo.class.getMethod("setBar2", Bar.class);
        processor.visitMethod(method, type);
        JavaResourceImpl resource = type.getResources().get("someName");
        assertFalse(resource.isOptional());
        assertEquals("mapped", resource.getMappedName());
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

        String name = JavaIntrospectionHelper.toPropertyName(method.getName());
        if (String.class.equals(paramType)) {
            JavaElementImpl element = new JavaElementImpl(method, 0);
            element.setName(name);
            element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
            JavaResourceImpl resource = new JavaResourceImpl(element);
            type.getResources().put(resource.getName(), resource);
        } else {
            throw new IllegalContextException(paramType.getName());
        }
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

        }
        Class<?> paramType = field.getType();
        if (String.class.equals(paramType)) {
            JavaElementImpl element = new JavaElementImpl(field);
            element.setClassifer(Resource.class);
            JavaResourceImpl resource = new JavaResourceImpl(element);
            type.getResources().put(resource.getName(), resource);
        } else {
            throw new IllegalContextException(paramType.getName());
        }
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

        if (type.getResources().get(name) != null) {
            throw new DuplicateResourceException(name);
        }

        String mappedName = annotation.mappedName();
        JavaResourceImpl resource = createResource(name, new JavaElementImpl(method, 0));
        resource.setOptional(annotation.optional());
        if (mappedName.length() > 0) {
            resource.setMappedName(mappedName);
        }
        type.getResources().put(resource.getName(), resource);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

            throw new DuplicateResourceException(name);
        }

        String mappedName = annotation.mappedName();

        JavaResourceImpl resource = createResource(name, new JavaElementImpl(field));
        resource.setOptional(annotation.optional());
        if (mappedName.length() > 0) {
            resource.setMappedName(mappedName);
        }
        type.getResources().put(resource.getName(), resource);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

        //setUpPolicyHandlers();
    }

    void addResourceFactory(String name, ObjectFactory<?> factory) {
        JavaResourceImpl resource = instanceFactoryProvider.getImplementation().getResources().get(name);

        if (resource != null && !(resource.getElement().getAnchor() instanceof Constructor)) {
            instanceFactoryProvider.getInjectionSites().add(resource.getElement());
        }

        instanceFactoryProvider.setObjectFactory(resource.getElement(), factory);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

        this.instanceFactory = instanceFactoryProvider.createFactory();

    }

    void addResourceFactory(String name, ObjectFactory<?> factory) {
        JavaResourceImpl resource = instanceFactoryProvider.getImplementation().getResources().get(name);

        if (resource != null && !(resource.getElement().getAnchor() instanceof Constructor)) {
            instanceFactoryProvider.getInjectionSites().add(resource.getElement());
        }

        instanceFactoryProvider.setObjectFactory(resource.getElement(), factory);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

        }
        String name = JavaIntrospectionHelper.toPropertyName(method.getName());
        JavaElementImpl element = new JavaElementImpl(method, 0);
        element.setName(name);
        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
        JavaResourceImpl resource = new JavaResourceImpl(element);
        type.getResources().put(resource.getName(), resource);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

        if (field.getAnnotation(ConversationID.class) == null) {
            return;
        }
        JavaElementImpl element = new JavaElementImpl(field);
        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
        JavaResourceImpl resource = new JavaResourceImpl(element);
        type.getResources().put(resource.getName(), resource);
    }
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.