private FunctionImport buildEdmFunctionImport(final Method method,
final EdmFunctionImport edmAnnotationFunctionImport)
throws ODataJPAModelException {
if (edmAnnotationFunctionImport != null && edmAnnotationFunctionImport.returnType() != null) {
FunctionImport functionImport = new FunctionImport();
if (edmAnnotationFunctionImport.name().equals("")) {
functionImport.setName(method.getName());
} else {
functionImport.setName(edmAnnotationFunctionImport.name());
}
JPAEdmMapping mapping = new JPAEdmMappingImpl();
((Mapping) mapping).setInternalName(method.getName());
mapping.setJPAType(method.getDeclaringClass());
functionImport.setMapping((Mapping) mapping);
functionImport.setHttpMethod(edmAnnotationFunctionImport.httpMethod().name().toString());
buildEdmReturnType(functionImport, method, edmAnnotationFunctionImport);
buildEdmParameter(functionImport, method);
return functionImport;