All Implemented Interfaces:
Type

public class InterfaceType extends ObjectType
This class represents an Interface, as defined in a GraphQL schema. In the generated classes, this needs to be an interface, as an object type may implement several interfaces. One of the issue to face, when generating the POJOs, is that we may have to instanciate an instance of this interface. For instance, in this GraphQL schema:
 interface Character {
    id: ID!
    name: String!
}

type Human implements Character {
    id: ID!
    name: String!
    friends: [Character]!
}

type Droid implements Character {
    id: ID!
    name: String!
    primaryFunction: String!
}
 
If you get a Human from a query, it will return its friends. But when returning it, you'll only get the its id and name. The mapper has to instanciate a POJO, but this POJO can't be a Human, nor a Droid.
To solve this, a GraphQL interface declaration let to two java files:
  • The interface itself. In the above case, the interface is named Character, as defined in the GraphQL schema.
  • A concrete Java class, implementing the interface itself, and only it. In the above case, the interface would be named CharacterImpl, a name derived from the interface named defined in the GraphQL schema. In the case where this name is an already defined type in the GraphQL schema, the generator will search for non used alternative names (CharacterImpl1, CharacterImpl2...)
Author:
etienne-sf