Annotation Interface NonNull


Specifies that the GraphQL type and/or input type represented by the Java field this annotation is applied to must be marked as non-null in the schema.

For example, a user might annotate a class' property as such:
 @Type("Starship")
 @Input("StarshipInput")
 public class Starship {
     private String id;
     @NonNull
     private String name;
     private float length;

     // getters/setters...
 }
 
Schema generation of this would result in a stanza such as:
 type Starship {
   id: String
   name: String!
   length: Float!
 }

 input StarshipInput {
   id: String
   name: String!
   length: Float!
 }
 


Note that all primitive fields/properties are automatically considered non-null unless they are also annotated with a DefaultValue annotation.