TypeMapper typeMapper = defNode.getProviderInstance(TypeMapper.class);
MovableStructureDefinition structDef =
structProv.buildStructure(rootDataNode, getReturnStructName(rootStruct, defNode), typeMapper);
// create MethodDef with StructureDef from StructureProvider as return value
final MethodDef method = new MethodDef(defNode.getDatacontrolOperation(), rootStruct);
rootStruct.addMethod(method);
// add parameters to method-definition if data provider has dynamic parameters
{
final Set<DynamicParameter> dynamicParams = defNode.getDynamicParams();
if (dynamicParams != null) {
for (DynamicParameter dynpar : dynamicParams) {
method.addParameter(dynpar.getName(), dynpar.getJavaType());
}
}
}
// link StructureDef to MethodDef using a MethodReturnDef
final MethodReturnDef methodReturn =
new MethodReturnDef(rootDataNode.getName(), structDef, method, COLLECTION_FALSE,
SCALAR_COLLECTION_FALSE);
structDef.setParent(methodReturn);
method.setReturnType(methodReturn);
// apply customizations to the structure
CustomizationProvider custProv = defNode.getProviderInstance(CustomizationProvider.class);
if (custProv != null) {
new Customizer(custProv).customize(method);