Codota Logo
GraphQLObjectType$Builder
Code IndexAdd Codota to your IDE (free)

How to use
GraphQLObjectType$Builder
in
graphql.schema

Best Java code snippets using graphql.schema.GraphQLObjectType$Builder (Showing top 20 results out of 315)

  • Common ways to obtain GraphQLObjectType$Builder
private void myMethod () {
GraphQLObjectType$Builder g =
  • Codota IconString str2;String str;GraphQLObjectType.newObject().name(str2).description(str)
  • Codota IconString str;GraphQLObjectType.newObject().name(str)
  • Smart code suggestions by Codota
}
origin: opentripplanner/OpenTripPlanner

.name("stopAtDistance")
.field(GraphQLFieldDefinition.newFieldDefinition()
  .name("stop")
  .type(stopType)
  .dataFetcher(environment -> ((GraphIndex.StopAndDistance) environment.getSource()).stop)
  .build())
.field(GraphQLFieldDefinition.newFieldDefinition()
  .name("distance")
  .type(Scalars.GraphQLInt)
  .dataFetcher(environment -> ((GraphIndex.StopAndDistance) environment.getSource()).distance)
  .build())
.build();
.name("StoptimesInPattern")
.field(GraphQLFieldDefinition.newFieldDefinition()
  .name("pattern")
  .type(patternType)
    .get(((StopTimesInPattern) environment.getSource()).pattern.id))
  .build())
.field(GraphQLFieldDefinition.newFieldDefinition()
  .name("stoptimes")
  .type(new GraphQLList(stoptimeType))
  .dataFetcher(environment -> ((StopTimesInPattern) environment.getSource()).times)
  .build())
.build();
.name("Cluster")
.withInterface(nodeInterface)
origin: graphql-java/graphql-java

void recursiveTypes() {
  GraphQLObjectType person = newObject()
      .name("Person")
      .field(newFieldDefinition()
          .name("friends")
          .type(GraphQLList.list(GraphQLTypeReference.typeRef("Person"))))
      .build();
}
origin: leangen/graphql-spqr

@Override
protected GraphQLObjectType toGraphQLType(String typeName, AnnotatedType javaType, OperationMapper operationMapper, BuildContext buildContext) {
  GraphQLObjectType.Builder builder = GraphQLObjectType.newObject()
      .name(typeName)
      .description(buildContext.typeInfoGenerator.generateTypeDescription(javaType, buildContext.messageBundle));
  Enum<E>[] keys = ClassUtils.<E>getRawType(getElementType(javaType, 0).getType()).getEnumConstants();
  Arrays.stream(keys).forEach(enumValue -> builder.field(GraphQLFieldDefinition.newFieldDefinition()
      .name(enumMapper.getValueName(enumValue, buildContext.messageBundle))
      .description(enumMapper.getValueDescription(enumValue, buildContext.messageBundle))
      .deprecate(enumMapper.getValueDeprecationReason(enumValue, buildContext.messageBundle))
      .type(operationMapper.toGraphQLType(getElementType(javaType, 1), buildContext))
      .dataFetcher(env -> ((Map)env.getSource()).get(enumValue))
      .build()));
  return builder.build();
}
origin: com.graphql-java/graphql-java

public GraphQLObjectType edgeType(String name, GraphQLOutputType nodeType, GraphQLInterfaceType nodeInterface, List<GraphQLFieldDefinition> edgeFields) {
  return newObject()
      .name(name + "Edge")
      .description("An edge in a connection")
      .field(newFieldDefinition()
          .name("node")
          .type(nodeType)
          .description("The item at the end of the edge"))
      .field(newFieldDefinition()
          .name("cursor")
          .type(nonNull(GraphQLString))
          .description("cursor marks a unique position or index into the connection"))
      .fields(edgeFields)
      .build();
}
origin: com.graphql-java/graphql-java

public Builder subscription(GraphQLObjectType.Builder builder) {
  return subscription(builder.build());
}
origin: creactiviti/giraphe

public static GraphQLObjectType.Builder elementTypeBuilder () {
 return objectTypeBuilder().withInterface(IElement.REF)
              .field(Fields.notNullStringField("id"));
}

origin: com.graphql-java/graphql-java

/**
 * This helps you transform the current GraphQLObjectType into another one by starting a builder with all
 * the current values and allows you to transform it how you want.
 *
 * @param builderConsumer the consumer code that will be given a builder to transform
 *
 * @return a new object based on calling build on that builder
 */
public GraphQLObjectType transform(Consumer<Builder> builderConsumer) {
  Builder builder = newObject(this);
  builderConsumer.accept(builder);
  return builder.build();
}
origin: creactiviti/graffiti

@Override
public void build (Builder aBuilder) {
 aBuilder.field(Fields.field("addDirector")
            .type(Director.REF)
            .argument(Arguments.notNullStringArgument("name"))
            .dataFetcher((env) -> {
             Node node = SimpleNode.builder(g) 
                        .type(Director.NAME)
                        .properties(env.getArguments())
                        .build();
             return g.add(node);
            }));
}
origin: creactiviti/spring-boot-starter-graphql

@Override
public void build (Builder aBuilder) {
 aBuilder.field(Fields.stringField("ping").staticValue("OK"));
}
origin: com.graphql-java/graphql-java

public GraphQLObjectType connectionType(String name, GraphQLObjectType edgeType, List<GraphQLFieldDefinition> connectionFields) {
  return newObject()
      .name(name + "Connection")
      .description("A connection to a list of items.")
      .field(newFieldDefinition()
          .name("edges")
          .description("a list of edges")
          .type(list(edgeType)))
      .field(newFieldDefinition()
          .name("pageInfo")
          .description("details about this specific page")
          .type(nonNull(pageInfoType)))
      .fields(connectionFields)
      .build();
}
origin: bsideup/graphql-java-reactive

@Test
public void testCompletableFuture() throws Exception {
  ReactiveExecutionStrategy strategy = new ReactiveExecutionStrategy();
  GraphQLSchema schema = newQuerySchema(it -> it
      .field(newStringField("a").dataFetcher(env -> CompletableFuture.completedFuture("static")))
  );
  ExecutionResult executionResult = new GraphQL(schema, strategy).execute("{ a }");
  Flowable.fromPublisher((Publisher<Change>) executionResult.getData()).timestamp(scheduler).subscribe(subscriber);
  subscriber
      .assertChanges(it -> it.containsExactly(
          tuple("00:000", "", ImmutableMap.of("a", "static"))
      ))
      .assertComplete();
}
origin: Enigmatis/graphql-java-annotations

@Test(expectedExceptions = InvalidDirectiveLocationException.class)
public void wireGraphQLUnionType_invalidLocations_exceptionIsThrown() throws Exception {
  // Arrange
  AnnotationsDirectiveWiring upperWiring = mock(AnnotationsDirectiveWiring.class);
  GraphQLUnionType directiveContainer = GraphQLUnionType.newUnionType().name("asdf")
      .possibleType(GraphQLObjectType.newObject().name("Asdfaaaa").build()).typeResolver(env -> null).build();
  AnnotationsWiringEnvironmentImpl upperCaseEnv = new AnnotationsWiringEnvironmentImpl(directiveContainer, directiveContainer.getDirective("upperCase"));
  when(upperWiring.onUnion(upperCaseEnv)).thenReturn(directiveContainer);
  HashMap<GraphQLDirective, AnnotationsDirectiveWiring> map = new HashMap<>();
  GraphQLDirective upperCase = newDirective().name("upperCase").build();
  map.put(upperCase, upperWiring);
  // Act
  directiveWirer.wire(directiveContainer, map);
}
origin: merapar/graphql-spring-boot-starter

  private GraphQLSchema generateGettingStartedGraphQlSchema() {
    val gettingStartedType = newObject()
        .name("gettingStartedQuery")
        .field(newFieldDefinition()
            .type(GraphQLString)
            .name("gettingStarted")
            .staticValue("Create a component and implement GraphQlFields interface."))
        .build();

    return GraphQLSchema.newSchema()
        .query(gettingStartedType)
        .build();
  }
}
origin: com.introproventures/graphql-jpa-query-schema

private GraphQLObjectType getObjectType(EntityType<?> entityType) {
  if (entityCache.containsKey(entityType))
    return entityCache.get(entityType);        
  
  
  GraphQLObjectType objectType = GraphQLObjectType.newObject()
      .name(entityType.getName())
      .description(getSchemaDescription( entityType.getJavaType()))
      .fields(entityType.getAttributes().stream()
        .filter(this::isNotIgnored)
        .map(this::getObjectField)
        .collect(Collectors.toList())
      )
      .build();
  
  entityCache.putIfAbsent(entityType, objectType);
  
  return objectType;
}
origin: Enigmatis/graphql-java-annotations

@Test(expectedExceptions = InvalidDirectiveLocationException.class)
public void wireGraphQLObjectType_invalidLocations_exceptionIsThrown() throws Exception {
  // Arrange
  AnnotationsDirectiveWiring upperWiring = mock(AnnotationsDirectiveWiring.class);
  GraphQLObjectType directiveContainer = GraphQLObjectType.newObject().name("asdf00").build();
  AnnotationsWiringEnvironmentImpl upperCaseEnv = new AnnotationsWiringEnvironmentImpl(directiveContainer, directiveContainer.getDirective("upperCase"));
  when(upperWiring.onObject(upperCaseEnv)).thenReturn(directiveContainer);
  HashMap<GraphQLDirective, AnnotationsDirectiveWiring> map = new HashMap<>();
  GraphQLDirective upperCase = newDirective().name("upperCase").build();
  map.put(upperCase, upperWiring);
  // Act
  directiveWirer.wire(directiveContainer, map);
}
origin: bpatters/schemagen-graphql

@Before
public void setup() {
  expectedObjectType = GraphQLObjectType.newObject()
      .name(CollectionsTestObject.class.getSimpleName())
      .field(GraphQLFieldDefinition.newFieldDefinition().name("field1").type(Scalars.GraphQLString).build())
      .field(GraphQLFieldDefinition.newFieldDefinition().name("field2").type(Scalars.GraphQLInt).build())
      .build();
  graphQLObjectMapper = new GraphQLObjectMapper(objectMapper,
      GraphQLSchemaBuilder.getDefaultTypeMappers(),
      Optional.<ITypeNamingStrategy>absent(),
      Optional.<IDataFetcherFactory>absent(),
      Optional.<Class<? extends IDataFetcher>>absent(),
      GraphQLSchemaBuilder.getDefaultTypeConverters(),
      ImmutableList.<Class<?>> of());
}
origin: bpatters/schemagen-graphql

@Override
public GraphQLOutputType getOutputType(IGraphQLObjectMapper objectMapper, Type type) {
  return GraphQLObjectType.newObject().name(objectMapper.getTypeNamingStrategy().getTypeName(objectMapper, type))
      .field(GraphQLFieldDefinition.newFieldDefinition().name("time").type(Scalars.GraphQLString).build()).build();
}
origin: bpatters/schemagen-graphql

private GraphQLOutputType getListOutputMapping(final IGraphQLObjectMapper graphQLObjectMapper, final Type type) {
  ParameterizedType pType = (ParameterizedType) type;
  GraphQLObjectType objectType = GraphQLObjectType.newObject()
      .name(graphQLObjectMapper.getTypeNamingStrategy().getTypeName(graphQLObjectMapper, type))
      .field(GraphQLFieldDefinition.newFieldDefinition()
          .name(KEY_NAME)
          .type(graphQLObjectMapper.getOutputType(pType.getActualTypeArguments()[0]))
          .build())
      .field(GraphQLFieldDefinition.newFieldDefinition()
          .name(VALUE_NAME)
          .type(graphQLObjectMapper.getOutputType(pType.getActualTypeArguments()[1]))
          .build())
      .build();
  return new GraphQLList(objectType);
}
origin: bsideup/graphql-java-reactive

  protected GraphQLSchema newQuerySchema(Consumer<GraphQLObjectType.Builder> queryConsumer) {
    GraphQLObjectType.Builder queryType = newObject().name("QueryType");

    queryConsumer.accept(queryType);

    return newSchema().query(queryType).build();
  }
}
origin: gentics/mesh

public GraphQLObjectType createFocalPointType() {
  Builder type = newObject().name("FocalPoint").description("Focal point");
  // .x
  type.field(newFieldDefinition().name("x").description("X-axis factor of the focal point. Left is 0 and middle is 0.5.").type(GraphQLFloat)
    .dataFetcher(fetcher -> {
      FocalPoint point = fetcher.getSource();
      return point.getX();
    }));
  // .y
  type.field(newFieldDefinition().name("y").description("Y-axis factor of the focal point. Top is 0 and middle is 0.5.").type(GraphQLFloat)
    .dataFetcher(fetcher -> {
      FocalPoint point = fetcher.getSource();
      return point.getY();
    }));
  return type.build();
}
graphql.schemaGraphQLObjectType$Builder

Most used methods

  • name
  • build
  • field
    Take a field builder in a function definition and apply. Can be used in a jdk8 lambda e.g.: field(f
  • description
  • fields
  • withInterface
  • <init>
  • withDirective
  • definition
  • hasField
  • withDirectives
  • withInterfaces
  • withDirectives,
  • withInterfaces

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • onCreateOptionsMenu (Activity)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Collectors (java.util.stream)
  • JPanel (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now