@SuppressWarnings("unchecked") public static SingleVariableDeclaration createAsyncCallbackParameter(AST ast,Type syncReturnType,String callbackParameterName,ImportRewrite imports){
  ITypeBinding syncReturnTypeBinding=syncReturnType.resolveBinding();
  SingleVariableDeclaration parameter=ast.newSingleVariableDeclaration();
  String gwtCallbackTypeSig=Signature.createTypeSignature(RemoteServiceUtilities.ASYNCCALLBACK_QUALIFIED_NAME,true);
  Type gwtCallbackType=imports.addImportFromSignature(gwtCallbackTypeSig,ast);
  if (syncReturnTypeBinding.isPrimitive()) {
    String wrapperName=JavaASTUtils.getWrapperTypeName(syncReturnTypeBinding.getName());
    String wrapperTypeSig=Signature.createTypeSignature(wrapperName,true);
    syncReturnType=imports.addImportFromSignature(wrapperTypeSig,ast);
  }
 else {
    syncReturnType=JavaASTUtils.normalizeTypeAndAddImport(ast,syncReturnType,imports);
  }
  ParameterizedType type=ast.newParameterizedType(gwtCallbackType);
  List<Type> typeArgs=type.typeArguments();
  typeArgs.add(syncReturnType);
  parameter.setType(type);
  parameter.setName(ast.newSimpleName(callbackParameterName));
  return parameter;
}

@ SuppressWarnings ( "unchecked" ) public static SingleVariableDeclaration createAsyncCallbackParameter ( AST ast , Type syncReturnType , String callbackParameterName , ImportRewrite imports ) { ITypeBinding syncReturnTypeBinding = syncReturnType . resolveBinding ( ) ; SingleVariableDeclaration parameter = ast . newSingleVariableDeclaration ( ) ; String gwtCallbackTypeSig = Signature . createTypeSignature ( RemoteServiceUtilities . ASYNCCALLBACK_QUALIFIED_NAME , true ) ; Type gwtCallbackType = imports . addImportFromSignature ( gwtCallbackTypeSig , ast ) ; if ( syncReturnTypeBinding . isPrimitive ( ) ) { String wrapperName = JavaASTUtils . getWrapperTypeName ( syncReturnTypeBinding . getName ( ) ) ; String wrapperTypeSig = Signature . createTypeSignature ( wrapperName , true ) ; syncReturnType = imports . addImportFromSignature ( wrapperTypeSig , ast ) ; } else { syncReturnType = JavaASTUtils . normalizeTypeAndAddImport ( ast , syncReturnType , imports ) ; } ParameterizedType type = ast . newParameterizedType ( gwtCallbackType ) ; List < Type > typeArgs = type . typeArguments ( ) ; typeArgs . add ( syncReturnType ) ; parameter . setType ( type ) ; parameter . setName ( ast . newSimpleName ( callbackParameterName ) ) ; return parameter ; }
creates a gwt rpc async callback parameter declaration based on the sync method return type .
