}
for (Method method : clazz.getMethods()) {
if (method.getDeclaringClass() == Object.class) {
continue;
}
Operation operation = opMap.get(method.getName());
DataBinding methodDataBinding = clazz.getAnnotation(DataBinding.class);
if (methodDataBinding == null) {
methodDataBinding = dataBinding;
}
dataBindingId = null;
wrapperStyle = false;
if (dataBinding != null) {
dataBindingId = dataBinding.value();
wrapperStyle = dataBinding.wrapped();
operation.setDataBinding(dataBindingId);
operation.setWrapperStyle(wrapperStyle);
}
// FIXME: We need a better way to identify simple java types
int i = 0;
for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getInputType().getLogical()) {
if (d.getDataBinding() == null) {
d.setDataBinding(dataBindingId);
}
for (Annotation a : method.getParameterAnnotations()[i]) {
if (a.annotationType() == org.apache.tuscany.sca.databinding.annotation.DataType.class) {
String value = ((org.apache.tuscany.sca.databinding.annotation.DataType)a).value();
d.setDataBinding(value);
}
}
dataBindingRegistry.introspectType(d, method.getParameterAnnotations()[i]);
i++;
}
if (operation.getOutputType() != null) {
DataType<?> d = operation.getOutputType();
if (d.getDataBinding() == null) {
d.setDataBinding(dataBindingId);
}
org.apache.tuscany.sca.databinding.annotation.DataType dt =
method.getAnnotation(org.apache.tuscany.sca.databinding.annotation.DataType.class);
if (dt != null) {
d.setDataBinding(dt.value());
}
dataBindingRegistry.introspectType(d, method.getAnnotations());
}
for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getFaultTypes()) {
if (d.getDataBinding() == null) {
d.setDataBinding(dataBindingId);
}
// TODO: Handle exceptions
dataBindingRegistry.introspectType(d, method.getAnnotations(), true);
}
// JIRA: TUSCANY-842
if (operation.getDataBinding() == null) {
assignOperationDataBinding(operation);
}
// FIXME: Do we want to heuristically check the wrapper style?
// introspectWrapperStyle(operation);