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

org.derive4j.processor.P2 Maven / Gradle / Ivy

Go to download

Annotation processor and framework for deriving algebraic data types constructors, morphisms, optics and typeclasses

There is a newer version: 1.1.1
Show newest version
/*
 * Copyright (c) 2017, Jean-Baptiste Giraudeau 
 *
 * This file is part of "Derive4J - Annotation Processor".
 *
 * "Derive4J - Annotation Processor" is free software: you can redistribute it
 * and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 *
 * "Derive4J - Annotation Processor" is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with "Derive4J - Annotation Processor".  If not, see .
 */
package org.derive4j.processor;

import java.util.function.BiFunction;
import org.derive4j.Data;
import org.derive4j.FieldNames;

@Data
abstract class P2 {

  P2() {

  }

  abstract  R match(@FieldNames({ "_1", "_2" }) BiFunction P2);

  final A _1() {

    return P2s.get_1(this);
  }

  final B _2() {

    return P2s.get_2(this);
  }

  @Override
  public abstract int hashCode();

  @Override
  public abstract boolean equals(Object obj);

  @Override
  public abstract String toString();

  static  P2 p2(A a, B b) {

    return P2s.P2(a, b);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy