com.bretpatterson.schemagen.graphql.datafetchers.spring.SpringDataFetcherFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of schemagen-graphql-spring Show documentation
Show all versions of schemagen-graphql-spring Show documentation
This provides type introspection and generation of GraphQL from Pojos.
package com.bretpatterson.schemagen.graphql.datafetchers.spring;
import com.bretpatterson.schemagen.graphql.IGraphQLObjectMapper;
import com.bretpatterson.schemagen.graphql.annotations.GraphQLSpringELDataFetcher;
import com.bretpatterson.schemagen.graphql.impl.DefaultDataFetcherFactory;
import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import graphql.schema.DataFetcher;
import org.springframework.beans.factory.access.el.SpringBeanELResolver;
import org.springframework.context.ApplicationContext;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Supports methods/fields annotated with the @GraphQLSpringDataFetcher annotation. This allows you to execute Spring EL expressions as part
* of your datafetching environment.
*/
public class SpringDataFetcherFactory extends DefaultDataFetcherFactory {
ApplicationContext context;
SpringBeanELResolver springBeanELResolver;
public SpringDataFetcherFactory(ApplicationContext context) {
this.context = context;
}
@Override
public DataFetcher newFieldDataFetcher(final IGraphQLObjectMapper graphQLObjectMapper, final Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy