com.xxdb.streaming.client.BasicMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-java Show documentation
Show all versions of api-java Show documentation
The messaging and data conversion protocol between Java and DolphinDB server
package com.xxdb.streaming.client;
import java.util.HashMap;
import com.xxdb.data.BasicAnyVector;
import com.xxdb.data.Entity;
public class BasicMessage implements IMessage {
private long offset = 0;
private String topic = "";
private BasicAnyVector msg = null;
private HashMap nameToIndex = null;
public BasicMessage(long offset, String topic, BasicAnyVector msg, HashMap nameToIndex) {
this.offset = offset;
this.topic = topic;
this.msg = msg;
this.nameToIndex = nameToIndex;
}
@SuppressWarnings("unchecked")
@Override
public T getValue(int colIndex) {
return (T) this.msg.getEntity(colIndex);
}
@SuppressWarnings("unchecked")
@Override
public T getValue(String colName) {
int colIndex = nameToIndex.get(colName.toLowerCase());
return (T) this.msg.getEntity(colIndex);
}
@Override
public String getTopic() {
return this.topic;
}
@Override
public long getOffset() {
return this.offset;
}
@Override
public Entity getEntity(int colIndex) {
return this.msg.getEntity(colIndex);
}
}