List of usage examples for twitter4j StatusUpdate location
GeoLocation location
To view the source code for twitter4j StatusUpdate location.
Click Source Link
From source file:org.springframework.integration.twitter.StatusUpdateSupport.java
License:Apache License
/** * {@link StatusUpdate} instances are used to drive status updates. * * @param message the inbound messages//from ww w . j av a 2 s. com * @return a {@link StatusUpdate} that's been materialized from the inbound message * @throws Throwable thrown if something goes wrong */ public StatusUpdate fromMessage(Message<?> message) throws Throwable { Object payload = message.getPayload(); StatusUpdate statusUpdate = null; if (payload instanceof String) { statusUpdate = new StatusUpdate((String) payload); if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_IN_REPLY_TO_STATUS_ID)) { Long replyId = (Long) message.getHeaders().get(TwitterHeaders.TWITTER_IN_REPLY_TO_STATUS_ID); if ((replyId != null) && (replyId > 0)) { statusUpdate.inReplyToStatusId(replyId); } } if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_PLACE_ID)) { String placeId = (String) message.getHeaders().get(TwitterHeaders.TWITTER_PLACE_ID); if (StringUtils.hasText(placeId)) { statusUpdate.placeId(placeId); } } if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_GEOLOCATION)) { GeoLocation geoLocation = (GeoLocation) message.getHeaders() .get(TwitterHeaders.TWITTER_GEOLOCATION); if (null != geoLocation) { statusUpdate.location(geoLocation); } } if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_DISPLAY_COORDINATES)) { Boolean displayCoords = (Boolean) message.getHeaders() .get(TwitterHeaders.TWITTER_DISPLAY_COORDINATES); if (displayCoords != null) { statusUpdate.displayCoordinates(displayCoords); } } } if (payload instanceof StatusUpdate) { statusUpdate = (StatusUpdate) payload; } return statusUpdate; }