private static ComponentBuilder<?> builderFromGenerator( Generator<?> source, ComponentDescriptor descriptor, BeneratorContext context) { boolean nullability = DescriptorUtil.isNullable(descriptor, context); Double nullQuota = descriptor.getNullQuota(); if (nullQuota != null && nullQuota != 0) source = context.getGeneratorFactory().applyNullSettings(source, nullability, nullQuota); TypeDescriptor typeDescriptor = descriptor.getTypeDescriptor(); String scope = (typeDescriptor != null ? typeDescriptor.getScope() : null); if (descriptor instanceof ArrayElementDescriptor) { int index = ((ArrayElementDescriptor) descriptor).getIndex(); return new ArrayElementBuilder(index, source, scope); } else return new PlainEntityComponentBuilder(descriptor.getName(), source, scope); }
@SuppressWarnings({"rawtypes", "unchecked"}) @Override protected Generator<?> applyComponentBuilders( Generator<?> generator, ArrayTypeDescriptor descriptor, String instanceName, Uniqueness uniqueness, BeneratorContext context) { Generator[] generators; // create synthetic element generators if necessary if (generator instanceof BlankArrayGenerator) { generators = createSyntheticElementGenerators(descriptor, uniqueness, context); generator = context .getGeneratorFactory() .createCompositeArrayGenerator(Object.class, generators, uniqueness); } // ... and don't forget to support the parent class' functionality generator = super.applyComponentBuilders(generator, descriptor, instanceName, uniqueness, context); return generator; }