Example usage for twitter4j UserMentionEntity getEnd

List of usage examples for twitter4j UserMentionEntity getEnd

Introduction

In this page you can find the example usage for twitter4j UserMentionEntity getEnd.

Prototype

@Override
int getEnd();

Source Link

Document

Returns the index of the end character of the user mention.

Usage

From source file:com.github.daytron.twaattin.ui.tabledecorator.TweetColumnDecorator.java

License:Open Source License

void createFragmentsWithMention(UserMentionEntity[] mentions) {

    if (mentions != null) {

        for (UserMentionEntity mention : mentions) {

            int start = mention.getStart();
            int end = mention.getEnd();

            String screenName = mention.getScreenName();

            String url = TWITTER_USER_URL + screenName;

            String href = "<a href='" + url + "' target='" + screenName + "'>";

            TweetFragment fragment = new TweetFragment(start, end, href + '@' + screenName + "</a>");

            fragments.add(fragment);/*from w ww .  j a  v a2 s.c o  m*/
        }
    }
}

From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java

License:Apache License

static Struct convertUserMentionEntity(UserMentionEntity userMentionEntity) {
    return new Struct(SCHEMA_USER_MENTION_ENTITY).put("Name", userMentionEntity.getName())
            .put("Id", userMentionEntity.getId()).put("Text", userMentionEntity.getText())
            .put("ScreenName", userMentionEntity.getScreenName()).put("Start", userMentionEntity.getStart())
            .put("End", userMentionEntity.getEnd());
}

From source file:com.mothsoft.alexis.engine.retrieval.TwitterRetrievalTaskImpl.java

License:Apache License

private List<TweetMention> readMentions(Status status) {
    final List<TweetMention> mentions = new ArrayList<TweetMention>();

    if (status.getUserMentionEntities() != null) {
        for (final UserMentionEntity entity : status.getUserMentionEntities()) {

            final Long userId = entity.getId();
            final String name = entity.getName();
            final String screenName = entity.getScreenName();

            final TweetMention mention = new TweetMention((short) entity.getStart(), (short) entity.getEnd(),
                    userId, name, screenName);
            mentions.add(mention);//from   w w  w  . j  a  v  a2  s  .  c o  m
        }
    }

    return mentions;
}

From source file:org.xmlsh.twitter.util.TwitterWriter.java

License:BSD License

private void write(String localName, UserMentionEntity e) throws XMLStreamException {
    startElement(localName);// w  w  w .  jav  a  2 s.  c o m
    attribute("id", sanitizeID(e.getId()));
    attribute("screen-name", sanitizeUser(e.getScreenName()));
    attribute("start", e.getStart());
    attribute("end", e.getEnd());
    endElement();

}