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

com.redis.om.spring.tuple.AbstractTupleMapper Maven / Gradle / Ivy

package com.redis.om.spring.tuple;

import java.util.function.Function;

import static java.util.Objects.requireNonNull;

public abstract class AbstractTupleMapper implements TupleMapper {

  private final Function[] mappers;

  @SuppressWarnings({ "unchecked" })
  protected AbstractTupleMapper(int degree) {
    this.mappers = new Function[degree];
  }

  @Override
  public final int degree() {
    return mappers.length;
  }

  @Override
  public final Function get(int index) {
    return mappers[index];
  }

  @SuppressWarnings("unchecked")
  protected final  Function getAndCast(int index) {
    return (Function) mappers[index];
  }

  protected final void set(int index, Function mapper) {
    mappers[index] = requireNonNull(mapper);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy