graphql.analysis.QueryReducer Maven / Gradle / Ivy
package graphql.analysis;
import graphql.PublicApi;
/**
* Used by {@link QueryTraverser} to reduce the fields of a Document (or part of it) to a single value.
*
* How this happens in detail (pre vs post-order for example) is defined by {@link QueryTraverser}.
*
* See {@link QueryTraverser#reducePostOrder(QueryReducer, Object)} and {@link QueryTraverser#reducePreOrder(QueryReducer, Object)}
*/
@PublicApi
@FunctionalInterface
public interface QueryReducer {
/**
* Called each time a field is visited.
*
* @param fieldEnvironment the environment to this call
* @param acc the previous result
*
* @return the new result
*/
T reduceField(QueryVisitorFieldEnvironment fieldEnvironment, T acc);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy