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

com.rapleaf.jack.store.field.AbstractJsField Maven / Gradle / Ivy

package com.rapleaf.jack.store.field;

import java.util.function.BiFunction;
import java.util.function.Function;

import com.rapleaf.jack.store.JsRecord;
import com.rapleaf.jack.store.executors.RecordUpdater;
import com.rapleaf.jack.store.executors.SubRecordUpdater;
import com.rapleaf.jack.store.iface.InsertValue;
import com.rapleaf.jack.store.iface.ValueIndexer;

public abstract class AbstractJsField implements JsField {

  private final String key;
  private final BiFunction putFunction;
  private final Function readFunction;

  AbstractJsField(String key, InsertValue putMethod, BiFunction getMethod) {
    this.key = key;
    this.putFunction = (recordUpdater, value) -> putMethod.apply(recordUpdater, key, value);
    this.readFunction = record -> getMethod.apply(record, key);
  }

  @Override
  public String getKey() {
    return key;
  }

  @Override
  public BiFunction getPutFunction() {
    return putFunction;
  }

  @Override
  public Function getReadFunction() {
    return readFunction;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy