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

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

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

import net.zerobuilder.compiler.generate.DtoBeanParameter.AbstractBeanParameter;
import net.zerobuilder.compiler.generate.DtoRegularParameter.ProjectedParameter;

import java.util.function.Function;

public final class DtoProjectedParameter {

  interface AbstractProjectedParameter {
     R acceptProjected(ProjectedParameterCases cases);
  }

  interface ProjectedParameterCases {
    R projectedRegular(ProjectedParameter regular);
    R projectedBean(AbstractBeanParameter bean);
  }

  static  Function asFunction(ProjectedParameterCases cases) {
    return parameter -> parameter.acceptProjected(cases);
  }

  static  Function projectedParameterCases(
      Function regularFunction,
      Function beanFunction) {
    return asFunction(new ProjectedParameterCases() {
      @Override
      public R projectedRegular(ProjectedParameter regular) {
        return regularFunction.apply(regular);
      }
      @Override
      public R projectedBean(AbstractBeanParameter bean) {
        return beanFunction.apply(bean);
      }
    });
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy