// Write the method here.. public void get__bookmarks( Map<String, ? extends Object> filter, RestAdapter restAdapter, final DataListCallback<Bookmark> callback) { // Call the onBefore callback method.. callback.onBefore(); // Define methods here.. final CustomerRepository customerRepo = restAdapter.createRepository(CustomerRepository.class); customerRepo.get__bookmarks( (String) that.getId(), filter, new DataListCallback<Bookmark>() { @Override public void onSuccess(DataList<Bookmark> object) { if (object != null) { // now add relation to this recipe. Bookmark obj = new Bookmark(); addRelation(object, obj); // Disabling two way communication for cyclic error.. /*for (Bookmark obj : object) { //Also add relation to child type for two way communication.. obj.addRelation(that); }*/ callback.onSuccess(object); // Calling the finally..callback callback.onFinally(); } else { callback.onSuccess(null); // Calling the finally..callback callback.onFinally(); } } @Override public void onError(Throwable t) { // Now calling the callback callback.onError(t); // Calling the finally..callback callback.onFinally(); } }); } // method def ends here.