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

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

package com.redis.om.spring.tuple;

import com.redis.om.spring.tuple.accessor.EighthAccessor;
import com.redis.om.spring.tuple.accessor.FifthAccessor;
import com.redis.om.spring.tuple.accessor.FirstAccessor;
import com.redis.om.spring.tuple.accessor.FourthAccessor;
import com.redis.om.spring.tuple.accessor.SecondAccessor;
import com.redis.om.spring.tuple.accessor.SeventhAccessor;
import com.redis.om.spring.tuple.accessor.SixthAccessor;
import com.redis.om.spring.tuple.accessor.ThirdAccessor;

public interface Octuple extends Tuple {

  E1 getFirst();

  E2 getSecond();

  E3 getThird();

  E4 getFourth();

  E5 getFifth();

  E6 getSixth();

  E7 getSeventh();

  T7 getEighth();

  @Override
  default int size() {
    return 8;
  }

  default Object get(int index) {
    switch (index) {
      case 0:
        return getFirst();
      case 1:
        return getSecond();
      case 2:
        return getThird();
      case 3:
        return getFourth();
      case 4:
        return getFifth();
      case 5:
        return getSixth();
      case 6:
        return getSeventh();
      case 7:
        return getEighth();
      default:
        throw new IndexOutOfBoundsException(
            String.format("Index %d is outside bounds of tuple of degree %s", index, size()));
    }
  }

  static  FirstAccessor, E1> getFirstGetter() {
    return Octuple::getFirst;
  }

  static  SecondAccessor, E2> getSecondGetter() {
    return Octuple::getSecond;
  }

  static  ThirdAccessor, E3> getThirdGetter() {
    return Octuple::getThird;
  }

  static  FourthAccessor, E4> getFourthGetter() {
    return Octuple::getFourth;
  }

  static  FifthAccessor, E5> getFifthGetter() {
    return Octuple::getFifth;
  }

  static  SixthAccessor, E6> getSixthGetter() {
    return Octuple::getSixth;
  }

  static  SeventhAccessor, E7> getSeventhGetter() {
    return Octuple::getSeventh;
  }

  static  EighthAccessor, T7> getEighthGetter() {
    return Octuple::getEighth;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy