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