package com.atlassian.bitbucket.mesh.git.builder.foreachref;

import com.atlassian.bitbucket.mesh.process.ProcessStdioHandler;

import javax.annotation.Nonnull;

/**
 * Abstraction around a {@link ProcessStdioHandler} for processing {@code git for-each-ref} output, tightly coupling
 * the output format for the executed command to the handler implementation for processing it.
 *
 * @param <T> The type of object returned after output has been processed
 */
public interface ForEachRefStdioHandler<T> extends ProcessStdioHandler<T> {

    /**
     * Retrieves the format which should be provided to {@code git for-each-ref --format=} to produce output which can
     * be consumed by this output handler.
     *
     * @return a format string, which <i>may not</i> be {@code null}
     */
    @Nonnull
    String getFormat();
}
