Package org.apache.tuscany.api.annotation

Examples of org.apache.tuscany.api.annotation.DataType


    }

    private void processInterface(Class<?> clazz,
                                  JavaServiceContract contract,
                                  Map<String, Operation<Type>> operations) {
        DataType interfaceDataType = clazz.getAnnotation(DataType.class);
        if (interfaceDataType != null) {
            contract.setDataBinding(interfaceDataType.name());
            // FIXME: [rfeng] Keep data context as metadata?
            for (DataContext c : interfaceDataType.context()) {
                contract.setMetaData(c.key(), c.value());
            }
        }
        for (Method method : clazz.getMethods()) {
            Operation<?> operation = operations.get(method.getName());
            DataType operationDataType = method.getAnnotation(DataType.class);

            if (operationDataType != null) {
                operation.setDataBinding(operationDataType.name());
                // FIXME: [rfeng] Keep data context as metadata?
                for (DataContext c : operationDataType.context()) {
                    operation.setMetaData(c.key(), c.value());
                }
            }

            String dataBinding = operation.getDataBinding();
View Full Code Here


public class DataBindingTestCase extends TestCase {
    @SuppressWarnings("unused")
    public void testDataType() throws Exception {
        Class<Test> testClass = Test.class;
        DataType d = testClass.getAnnotation(DataType.class);
        Assert.assertEquals(d.name(), "sdo");
        Assert.assertEquals(d.context().length, 0);

        Method method = testClass.getMethod("test", new Class[] {Object.class});
        DataType d2 = method.getAnnotation(DataType.class);
        Assert.assertEquals(d2.name(), "jaxb");
        Assert.assertEquals(d2.context()[0].key(), "contextPath");
        Assert.assertEquals(d2.context()[0].value(), "com.example.ipo.jaxb");
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.api.annotation.DataType

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.