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

io.deephaven.kafka.ingest.JsonNodeLongFieldCopier Maven / Gradle / Ivy

The newest version!
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY
// ****** Edit JsonNodeCharFieldCopier and run "./gradlew replicateKafka" to regenerate
//
// @formatter:off
package io.deephaven.kafka.ingest;

import com.fasterxml.jackson.core.JsonPointer;
import io.deephaven.chunk.ObjectChunk;
import io.deephaven.chunk.WritableLongChunk;
import io.deephaven.chunk.WritableChunk;
import com.fasterxml.jackson.databind.JsonNode;
import io.deephaven.chunk.attributes.Values;

public class JsonNodeLongFieldCopier implements FieldCopier {
    private final JsonPointer fieldPointer;

    public JsonNodeLongFieldCopier(final String fieldPointerStr) {
        this.fieldPointer = JsonPointer.compile(fieldPointerStr);
    }

    @Override
    public void copyField(
            final ObjectChunk inputChunk, final WritableChunk publisherChunk,
            final int sourceOffset, final int destOffset, final int length) {
        final WritableLongChunk output = publisherChunk.asWritableLongChunk();
        for (int ii = 0; ii < length; ++ii) {
            final JsonNode node = (JsonNode) inputChunk.get(ii + sourceOffset);
            output.set(ii + destOffset, JsonNodeUtil.getLong(node, fieldPointer, true, true));
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy