All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.agora.rtm.TopicEvent Maven / Gradle / Ivy

package io.agora.rtm;

import io.agora.common.internal.CalledByNative;
import io.agora.rtm.RtmConstants.RtmTopicEventType;
import io.agora.rtm.TopicInfo;
import java.util.ArrayList;
import java.util.Arrays;

public class TopicEvent {
  /**
   * Indicate topic event type
   */
  private RtmTopicEventType type;

  /**
   * The channel which the topic event was triggered
   */
  private String channelName = "";

  /**
   * The user who triggered this event.
   */
  private String publisher = "";

  /**
   * Topic information array.
   */
  private ArrayList topicInfos;

  /**
   * The default Constructor of {@code TopicEvent}.
   */
  public TopicEvent() {
    this.type = RtmTopicEventType.NONE;
    this.topicInfos = new ArrayList();
  }

  public RtmTopicEventType getType() {
    return this.type;
  }

  public String getChannelName() {
    return this.channelName;
  }

  public String getPublisher() {
    return this.publisher;
  }

  public ArrayList getTopicInfos() {
    return this.topicInfos;
  }

  @CalledByNative
  public TopicEvent(String channelName, int type, String publisher, TopicInfo[] topicInfos) {
    this.type = RtmTopicEventType.getEnum(type);
    this.channelName = channelName;
    this.publisher = publisher;
    this.topicInfos = new ArrayList(Arrays.asList(topicInfos));
  }

  @Override
  public String toString() {
    return "TopicEvent {channelName: " + channelName + ", type: " + type
        + ", publisher: " + publisher + ", topicInfos: " + topicInfos + "}";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy