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

com.casper.sdk.service.impl.event.RawEvent Maven / Gradle / Ivy

Go to download

SDK to streamline the 3rd party Java client integration processes. Such 3rd parties include exchanges & app developers.

The newest version!
package com.casper.sdk.service.impl.event;

import com.casper.sdk.model.event.DataType;
import com.casper.sdk.model.event.EventTarget;
import lombok.ToString;

/**
 * An event that contains the event data as raw JSON without the 'data:' prefix is returned from the event service when
 * a {@link EventTarget#RAW} is requested.
 *
 * @author [email protected]
 */
@ToString(doNotUseGetters = true, callSuper = true)
final class RawEvent extends AbstractEvent {

    RawEvent(final String source, final Long id, final String data, final String version) {
        super(getDataType(data), source, id, data, version);
    }

    private static DataType getDataType(final String data) {

        final String replace = data.substring(2);
        final String[] split = replace.split(":");
        final String dataTypeName = split[0].substring(0, split[0].length() - 1);
        return DataType.of(dataTypeName.trim());
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy