public static ClassRef buildableRef(TypeRef typeRef) { ClassRef unwrapped = (ClassRef) TypeAs.combine(UNWRAP_COLLECTION_OF, UNWRAP_ARRAY_OF, UNWRAP_OPTIONAL_OF).apply(typeRef); return isAbstract(unwrapped) || unwrapped.getDefinition().getKind() == Kind.INTERFACE ? TypeAs.VISITABLE_BUILDER.apply(unwrapped) : TypeAs.BUILDER.apply(unwrapped.getDefinition()).toInternalReference(); }
boolean isList = TypeUtils.isList(toAdd.getTypeRef()); boolean isMap = TypeUtils.isMap(toAdd.getTypeRef()); boolean isAbstract = isAbstract(unwrapped); boolean isOptional = TypeUtils.isOptional(toAdd.getTypeRef()) || TypeUtils.isOptionalInt(toAdd.getTypeRef())
if (isBuildable(unwrapped) && !isAbstract(unwrapped)) { TypeDef builder = BUILDER.apply(((ClassRef) unwrapped).getDefinition()); String builderClass = builder.toReference().getName();
final boolean isList = TypeUtils.isList(property.getTypeRef()); final boolean isMap = TypeUtils.isMap(property.getTypeRef()); final boolean isAbstract = isAbstract(unwrapped); boolean isOptional = TypeUtils.isOptional(property.getTypeRef()) || TypeUtils.isOptionalInt(property.getTypeRef())
if (isBuildable || hasDescendants) { ClassRef unwarppedClassRef = (unwrapped instanceof ClassRef) ? (ClassRef) unwrapped : null; targetType = isAbstract(unwarppedClassRef) || unwarppedClassRef.getDefinition().getKind() == Kind.INTERFACE ? TypeAs.VISITABLE_BUILDER.apply(unwarppedClassRef) : TypeAs.BUILDER.apply(unwarppedClassRef.getDefinition()).toInternalReference();
List<Statement> statements = new ArrayList<Statement>(); Set<Property> descendants = Descendants.PROPERTY_BUILDABLE_DESCENDANTS.apply(property); if (isBuildable(unwrapped) && !isAbstract(unwrapped)) { final ClassRef targetType = (ClassRef) unwrapped; if (property.hasAttribute(Constants.DESCENDANT_OF)) {
String prepareOptionalSource=""; if (isBuildable(unwrapped) && !isAbstract(unwrapped)) { TypeDef builder = BUILDER.apply(((ClassRef) unwrapped).getDefinition()); prepareSource = builder.getName() + " b = new " + builder.getName() + "(" + fieldName + "); _visitables.add(b);";
List<Statement> collectionInit = new ArrayList<Statement>(); if (isBuildable(unwrapped) && !isAbstract(unwrapped)) { final ClassRef targetType = (ClassRef) unwrapped;
ClassRef unwrapped = (ClassRef) TypeAs.combine(UNWRAP_COLLECTION_OF, UNWRAP_ARRAY_OF, UNWRAP_OPTIONAL_OF).apply(typeRef); ClassRef classRef = (ClassRef) typeRef; ClassRef builderType = isAbstract(unwrapped) || unwrapped.getDefinition().getKind() == Kind.INTERFACE ? TypeAs.VISITABLE_BUILDER.apply(unwrapped) : TypeAs.BUILDER.apply(unwrapped.getDefinition()).toInternalReference();