@Override public @NonNull B applyDeep(final @NonNull Consumer<Builder<?, ?>> consumer) { this.apply(consumer); if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final Builder<?, ?> childBuilder = ((BuildableComponent) child).toBuilder(); childBuilder.applyDeep(consumer); it.set(childBuilder.build()); } return (B) this; }
@Override public @NonNull B mapChildrenDeep(final @NonNull Function<BuildableComponent<? ,?>, BuildableComponent<? ,?>> function) { if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final BuildableComponent mappedChild = function.apply((BuildableComponent) child); if(mappedChild.children().isEmpty()) { if(child == mappedChild) { continue; } it.set(mappedChild); } else { final Builder<?, ?> builder = mappedChild.toBuilder(); builder.mapChildrenDeep(function); it.set(builder.build()); } } return (B) this; }
@Override @SuppressWarnings({"rawtypes", "unchecked"}) public @NonNull B mapChildrenDeep(final @NonNull Function<BuildableComponent<? ,?>, BuildableComponent<? ,?>> function) { if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final BuildableComponent mappedChild = function.apply((BuildableComponent) child); if(mappedChild.children().isEmpty()) { if(child == mappedChild) { continue; } it.set(mappedChild); } else { final Builder<?, ?> builder = mappedChild.toBuilder(); builder.mapChildrenDeep(function); it.set(builder.build()); } } return (B) this; }
@Override @SuppressWarnings({"rawtypes", "unchecked"}) public @NonNull B mapChildrenDeep(final @NonNull Function<BuildableComponent<? ,?>, BuildableComponent<? ,?>> function) { if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final BuildableComponent mappedChild = function.apply((BuildableComponent) child); if(mappedChild.children().isEmpty()) { if(child == mappedChild) { continue; } it.set(mappedChild); } else { final Builder<?, ?> builder = mappedChild.toBuilder(); builder.mapChildrenDeep(function); it.set(builder.build()); } } return (B) this; }
@Override @SuppressWarnings("unchecked") public @NonNull B applyDeep(final @NonNull Consumer<Builder<?, ?>> consumer) { this.apply(consumer); if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final Builder<?, ?> childBuilder = ((BuildableComponent) child).toBuilder(); childBuilder.applyDeep(consumer); it.set(childBuilder.build()); } return (B) this; }
@Override @SuppressWarnings("unchecked") public @NonNull B applyDeep(final @NonNull Consumer<Builder<?, ?>> consumer) { this.apply(consumer); if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final Builder<?, ?> childBuilder = ((BuildableComponent) child).toBuilder(); childBuilder.applyDeep(consumer); it.set(childBuilder.build()); } return (B) this; }
final BuildableComponent<?, ?> child = this.deserialize(childElement, childElement.getClass(), context); if(parent == null) { parent = child.toBuilder(); } else { parent.append(child);
final BuildableComponent<?, ?> child = this.deserialize(childElement, childElement.getClass(), context); if(parent == null) { parent = child.toBuilder(); } else { parent.append(child);