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

com.marklogic.client.datamovement.impl.BatchImpl Maven / Gradle / Ivy

The newest version!
/*
 * Copyright © 2024 MarkLogic Corporation. All Rights Reserved.
 */
package com.marklogic.client.datamovement.impl;

import java.lang.reflect.Array;
import java.util.Calendar;

import com.marklogic.client.DatabaseClient;
import com.marklogic.client.MarkLogicInternalException;
import com.marklogic.client.datamovement.Batch;
import com.marklogic.client.datamovement.JobTicket;

public class BatchImpl extends BatchEventImpl implements Batch {
  private T[] items;
  private Class as;

  public BatchImpl(Class as) {
    super();
    if (as == null) {
      throw new MarkLogicInternalException("batch instantiated without type token");
    }
    this.as = as;
  }

  @Override
  public T[] getItems() {
    if (items == null) {
      return (T[]) Array.newInstance(as, 0);
    }
    return items;
  }
  public BatchImpl withItems(T[] items) {
    this.items = items;
    return this;
  }

  public BatchImpl withClient(DatabaseClient client) {
    return (BatchImpl) super.withClient(client);
  }
  public BatchImpl withTimestamp(Calendar timestamp) {
    return (BatchImpl) super.withTimestamp(timestamp);
  }
  public BatchImpl withJobTicket(JobTicket jobTicket) {
    return (BatchImpl) super.withJobTicket(jobTicket);
  }
  public BatchImpl withJobBatchNumber(long jobBatchNumber) {
    return (BatchImpl) super.withJobBatchNumber(jobBatchNumber);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy