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

com.xxdb.streaming.client.BasicMessage Maven / Gradle / Ivy

Go to download

The messaging and data conversion protocol between Java and DolphinDB server

There is a newer version: 1.0.27
Show newest version
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);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy