net.zerobuilder.compiler.generate.DtoProjectedDescription Maven / Gradle / Ivy
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");
}
}