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

net.zerobuilder.compiler.generate.DtoSimpleDescription Maven / Gradle / Ivy

There is a newer version: 1.603
Show newest version
package net.zerobuilder.compiler.generate;

import net.zerobuilder.compiler.generate.DtoBeanGoalDescription.BeanGoalDescription;
import net.zerobuilder.compiler.generate.DtoRegularGoalDescription.SimpleRegularGoalDescription;

import java.util.function.Function;

public final class DtoSimpleDescription {

  public interface SimpleDescription {
     R acceptSimple(SimpleDescriptionCases cases);
  }

  interface SimpleDescriptionCases {
    R regular(SimpleRegularGoalDescription regular);
    R bean(BeanGoalDescription bean);
  }

  static  Function asFunction(SimpleDescriptionCases cases) {
    return description -> description.acceptSimple(cases);
  }

  static  Function simpleDescriptionCases(
      Function regularFunction,
      Function beanFunction) {
    return asFunction(new SimpleDescriptionCases() {
      @Override
      public R regular(SimpleRegularGoalDescription regular) {
        return regularFunction.apply(regular);
      }
      @Override
      public R bean(BeanGoalDescription bean) {
        return beanFunction.apply(bean);
      }
    });
  }

  private DtoSimpleDescription() {
    throw new UnsupportedOperationException("no instances");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy