简体   繁体   English

java.util.Set的等效模式数据类型是什么?

[英]What's the equivalent schema datatype for java.util.Set?

I am using GraphQL for Java and need to use Set / HashSet datatype for one of the member of my existing POJO to build by GraphQL schema. 我正在使用GraphQL for Java,并且需要使用Set / HashSet数据类型作为我现有POJO的成员之一来构建GraphQL模式。 Any advice and insight is appreciated. 任何建议和见解表示赞赏。

There is no built-in set type in GraphQL , sorry about that. GraphQL中没有内置的set类型,抱歉。

What you get the closest one is List type which is represented by enclosing any types using [ and ] such as [String] , [Int] , [Bar] etc. It can accept multiple elements but does not guarantee uniqueness between the containing elements. 你得到的最接近的是List类型,它用[]括起任何类型来表示,如[String][Int][Bar]等。它可以接受多个元素,但不保证包含元素之间的唯一性。

You may consider to implement a directive for a set behaviour. 您可以考虑为set行为实现指令 May be called @set which is placed along with the list data type when defining your GraphQL schema. 在定义GraphQL架构时,可以将@set称为@set ,它与列表数据类型一起放置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM