@Override
    protected Traverser.Admin<String> processNextStart() {
        final Traverser.Admin traverser = this.starts.next();

        boolean productive = true;
        int lastIndex = 0;
        final StringBuilder output = new StringBuilder();
        final Matcher matcher = VARIABLE_PATTERN.matcher(format);
        final Object current = traverser.get();

        while (matcher.find()) {
            final String varName = matcher.group(1);
            if (varName == null) continue;

            if (!varName.equals(FROM_BY) && current instanceof Element) {
                final Property prop = ((Element) current).property(varName);
                if (prop != null && prop.isPresent()) {
                    output.append(format, lastIndex, matcher.start()).append(prop.value());
                    lastIndex = matcher.end();
                    continue;
                }
            }

            final TraversalProduct product = varName.equals(FROM_BY) ?
                    TraversalUtil.produce(traverser, this.traversalRing.next()) :
                    TraversalUtil.produce((S) this.getNullableScopeValue(Pop.last, varName, traverser), null);

            if (!product.isProductive() || product.get() == null) {
                productive = false;
                break;
            }

            output.append(format, lastIndex, matcher.start()).append(product.get());
            lastIndex = matcher.end();
        }

        if (lastIndex < format.length()) {
            output.append(format, lastIndex, format.length());
        }

        this.traversalRing.reset();

        return productive ?
                PathProcessor.processTraverserPathLabels(traverser.split(output.toString(), this), this.keepLabels) :
                EmptyTraverser.instance();
    }
Reference implementation for String format step, a mid-traversal step which will handle result formatting
to string values. If the incoming traverser is a non-String value then an {@code IllegalArgumentException}
will be thrown.

@author Valentyn Kahamlyk
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/FormatStep.java