private void doWalk()

in src/main/java/com/epam/eco/commons/avro/traversal/SchemaTraverser.java [64:95]


    private void doWalk(Path desiredPath, Schema parentSchema, Schema schema) {
        if (!isCurrentPathTraversable(desiredPath)) {
            return;
        }

        listener.onSchema(getCurrentPathString(), parentSchema, schema);
        if (Type.ARRAY == schema.getType()) {
            doWalk(desiredPath, schema, schema.getElementType());
        } else if (Type.MAP == schema.getType()) {
            doWalk(desiredPath, schema, schema.getValueType());
        } else if (Type.RECORD == schema.getType()) {
            if (!storeRecordTypeAsHandled(schema)) {
                return;
            }
            for (Field field : schema.getFields()) {
                try {
                    appendToCurrentPath(field.name());
                    if (!isCurrentPathTraversable(desiredPath)) {
                        continue;
                    }
                    listener.onSchemaField(getCurrentPathString(), schema, field);
                    doWalk(desiredPath, schema, field.schema());
                } finally {
                    subtractFromCurrentPath();
                }
            }
        } else if (Type.UNION == schema.getType()) {
            for (Schema unionItemSchema : schema.getTypes()) {
                doWalk(desiredPath, schema, unionItemSchema);
            }
        }
    }