use of io.sundr.builder.annotations.Inline in project sundrio by sundrio.
the class AbstractBuilderProcessor method generateBuildables.
public void generateBuildables(BuilderContext ctx, Set<TypeDef> buildables) {
int total = ctx.getBuildableRepository().getBuildables().size();
int count = 0;
for (TypeDef typeDef : buildables) {
RichTypeDef richTypeDef = TypeArguments.apply(typeDef);
double percentage = 100d * (count++) / total;
if (typeDef.isInterface() || typeDef.isAnnotation()) {
continue;
}
System.err.printf("\033[2K%3d%% Generating: %s\r", Math.round(percentage), typeDef.getFullyQualifiedName());
generate(ClazzAs.FLUENT_INTERFACE.apply(richTypeDef));
generate(ClazzAs.FLUENT_IMPL.apply(richTypeDef));
if (typeDef.isAbstract()) {
continue;
}
if (!typeDef.isFinal() && typeDef.getAttributes().containsKey(EDITABLE_ENABLED) && (Boolean) typeDef.getAttributes().get(EDITABLE_ENABLED)) {
generate(ClazzAs.EDITABLE_BUILDER.apply(richTypeDef));
generate(ClazzAs.EDITABLE.apply(richTypeDef));
} else {
generate(ClazzAs.BUILDER.apply(richTypeDef));
}
Buildable buildable = typeDef.getAttribute(BUILDABLE);
ExternalBuildables externalBuildables = typeDef.getAttribute(EXTERNAL_BUILDABLE);
if (buildable != null) {
for (final Inline inline : buildable.inline()) {
generate(inlineableOf(ctx, typeDef, inline));
}
} else if (externalBuildables != null) {
for (final Inline inline : externalBuildables.inline()) {
generate(inlineableOf(ctx, typeDef, inline));
}
}
}
}
Aggregations