Java Code Examples for graphql.language.InputObjectTypeDefinition#getInputValueDefinitions()

The following examples show how to use graphql.language.InputObjectTypeDefinition#getInputValueDefinitions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GqlParentType.java    From manifold with Apache License 2.0 6 votes vote down vote up
private void addInnerInputType( InputObjectTypeDefinition type, SrcLinkedClass enclosingType )
{
  String identifier = makeIdentifier( type.getName(), false );
  String fqn = getFqn() + '.' + identifier;
  SrcLinkedClass srcClass = new SrcLinkedClass( fqn, enclosingType, Interface )
    .addInterface( IJsonBindingsBacked.class.getSimpleName() )
    .addAnnotation( new SrcAnnotationExpression( Structural.class.getSimpleName() )
      .addArgument( "factoryClass", Class.class, identifier + ".ProxyFactory.class" ) )
    .modifiers( Modifier.PUBLIC );
  addUnionInterfaces( type, srcClass );
  addActualNameAnnotation( srcClass, type.getName(), false );
  addSourcePositionAnnotation( srcClass, type, srcClass );
  addProxyFactory( srcClass );
  addBuilder( srcClass, type );
  addCreateMethod( srcClass, type );
  addBuilderMethod( srcClass, type );
  List<InputValueDefinition> inputValueDefinitions = type.getInputValueDefinitions();
  for( InputValueDefinition member: inputValueDefinitions )
  {
    addMember( srcClass, member, name -> inputValueDefinitions.stream().anyMatch( f -> f.getName().equals( name ) ) );
  }
  addInputExtensions( type, srcClass );
  enclosingType.addInnerClass( srcClass );
}
 
Example 2
Source File: GqlParentType.java    From manifold with Apache License 2.0 6 votes vote down vote up
private void addInputExtensions( InputObjectTypeDefinition type, SrcLinkedClass srcClass )
{
  List<InputValueDefinition> baseInputValueDefinitions = type.getInputValueDefinitions();
  List<InputObjectTypeExtensionDefinition> inputExtensions = _registry.inputObjectTypeExtensions().get( type.getName() );
  if( inputExtensions != null )
  {
    for( InputObjectTypeExtensionDefinition ext: inputExtensions )
    {
      List<InputValueDefinition> extInputValueDefinitions = ext.getInputValueDefinitions();
      for( InputValueDefinition member: extInputValueDefinitions )
      {
        addMember( srcClass, member,
          name ->
            baseInputValueDefinitions.stream().anyMatch( f -> f.getName().equals( name ) ) ||
            extInputValueDefinitions.stream().anyMatch( f -> f.getName().equals( name ) )
        );
      }
    }
  }
}
 
Example 3
Source File: STModel.java    From graphql-apigen with Apache License 2.0 5 votes vote down vote up
private List<Field> getFields(InputObjectTypeDefinition def) {
    List<Field> fields = new ArrayList<Field>();
    for ( InputValueDefinition fieldDef : def.getInputValueDefinitions() ) {
        Field field = new Field(fieldDef.getName(), toJavaTypeName(fieldDef.getType()));
        field.graphQLType = toGraphQLType(fieldDef.getType());
        field.defaultValue = toJavaValue(fieldDef.getDefaultValue());
        fields.add(field);
    }
    return fields;
}
 
Example 4
Source File: STModel.java    From graphql-apigen with Apache License 2.0 4 votes vote down vote up
private void addImports(Collection<String> imports, InputObjectTypeDefinition def) {
    for ( InputValueDefinition fieldDef : def.getInputValueDefinitions() ) {
        addImports(imports, fieldDef.getType());
    }
}