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

net.zerobuilder.compiler.generate.DtoProjectedDescription 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.ProjectedRegularGoalDescription;

import java.util.function.Function;

public final class DtoProjectedDescription {

  public interface ProjectedDescription {
     R acceptProjected(ProjectedDescriptionCases cases);
  }

  interface ProjectedDescriptionCases {
    R regular(ProjectedRegularGoalDescription regular);
    R bean(BeanGoalDescription bean);
  }

  static  Function asFunction(ProjectedDescriptionCases cases) {
    return description -> description.acceptProjected(cases);
  }

  static  Function projectedDescriptionCases(
      Function regularFunction,
      Function beanFunction) {
    return asFunction(new ProjectedDescriptionCases() {
      @Override
      public R regular(ProjectedRegularGoalDescription regular) {
        return regularFunction.apply(regular);
      }
      @Override
      public R bean(BeanGoalDescription bean) {
        return beanFunction.apply(bean);
      }
    });
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy