@Override public void handle(ChangesetInfo tea) { if(earliest == null || earliest.dateCreated.after(tea.dateCreated)) { earliest = tea; relayTo.handle(tea); foundMore = true; } } }
@Override public void getAll(BoundingBox bounds, Handler<Note> handler, int limit, int hideClosedNoteAfter) { // ignoring all the parameters except the handler... for(Note note : notes) { handler.handle(note); } } }
private void setUpThereIsANoteFor(CreateNote createNote, final Note note) { when(mapDataDao.getWay(createNote.elementId)).thenReturn(mock(Way.class)); doAnswer(invocation -> { Handler<Note> handler = (Handler<Note>) invocation.getArguments()[1]; handler.handle(note); return null; }).when(notesDao).getAll(any(), any(), anyInt(), anyInt()); }
@Override protected void handleElement(T element) { handler.handle(element); } }
@Override protected void onEndElement() { String name = getName(); if(name.equals(GPX_FILE)) { handler.handle(trace); trace = null; } else if(name.equals(DESCRIPTION)) { trace.description = getText(); } else if(name.equals(TAG)) { if(trace.tags == null) trace.tags = new ArrayList<String>(); trace.tags.add(getText()); } } }
currentChangesetInfo.discussion = comments; handler.handle(currentChangesetInfo); currentChangesetInfo = null;
@Override protected void onEndElement() { String name = getName(); String parent = getParentName(); if(USER.equals(name)) { handler.handle(userDetails); user = userDetails = null; } else if(LANGUAGES.equals(name)) { userDetails.preferredLanguages = languages; languages = null; } if(LANGUAGES.equals(parent)) { if("lang".equals(name)) { assert languages != null; languages.add(getText()); } } } }
@Override protected void onEndElement() throws ParseException { String name = getName(); if(TRACKPOINT.equals(name)) { handler.handle(trackpoint); trackpoint = null; } else if(TRACKPOINT.equals(getParentName())) { if(name.equals("time")) trackpoint.time = dateFormat.parse(getText()); if(name.equals("ele")) trackpoint.elevation = Float.valueOf(getText()); if(name.equals("hdop")) trackpoint.horizontalDilutionOfPrecision = Float.valueOf(getText()); } } }
@Override protected void onStartElement() { String name = getName(); if (name.equals(NODE) || name.equals(WAY) || name.equals(RELATION)) { DiffElement e = new DiffElement(); e.type = Element.Type.valueOf(name.toUpperCase(Locale.UK)); e.clientId = getLongAttribute("old_id"); e.serverId = getLongAttribute("new_id"); e.serverVersion = getIntAttribute("new_version"); handler.handle(e); } }
handler.handle( user ); user = null;
handler.handle( currentNote ); currentNote = null;