private SentimentAlchemyEntity getSentiment ( final JSONObject jsonKeyword ) { SentimentAlchemyEntity sentiment = null ; final JSONObject sentimentObject = getJSONObject ( JSONConstants . SENTIMENT_KEY , jsonKeyword ) ; if ( sentimentObject == null ) { return sentiment ; } final String type = getString ( JSONConstants . SENTIMENT_TYPE_KEY , sentimentObject ) ; final Double score = getDouble ( JSONConstants . SENTIMENT_SCORE_KEY , sentimentObject ) ; final Integer mixed = getInteger ( JSONConstants . SENTIMENT_MIXED_KEY , sentimentObject ) ; if ( isValidSentiment ( type , score , mixed ) ) { sentiment = new SentimentAlchemyEntity ( ) ; if ( ! StringUtils . isBlank ( type ) ) { sentiment . setType ( type ) ; } if ( score != null ) { sentiment . setScore ( score ) ; } if ( mixed != null ) { sentiment . setIsMixed ( mixed ) ; } } return sentiment ; }
Return a sentiment object populated by the values in the json object . Return null if there are no sentiment data .