本文整理汇总了Java中graphql.schema.DataFetchingEnvironment.containsArgument方法的典型用法代码示例。如果您正苦于以下问题:Java DataFetchingEnvironment.containsArgument方法的具体用法?Java DataFetchingEnvironment.containsArgument怎么用?Java DataFetchingEnvironment.containsArgument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphql.schema.DataFetchingEnvironment
的用法示例。
在下文中一共展示了DataFetchingEnvironment.containsArgument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
@Override
public List<Category> get(DataFetchingEnvironment environment) {
if (environment.containsArgument("match")) {
try {
final Object name = environment.getArgument("match");
final Query<Category> categoryQuery = new QueryBuilder<>(Category.class)
.contains("name", name.toString())
.build();
try (Stream<Category> categoryStream = getDao().find(categoryQuery)) {
return categoryStream.collect(Collectors.toList());
}
} catch (NoSuchFieldException e) {
throw new UncheckedSQLException("Cant build query", e);
}
}
try (Stream<Category> all = getDao().findAll()) {
return all.collect(Collectors.toList());
}
}
示例2: get
import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
@Override
public Category get(DataFetchingEnvironment environment) {
final String name = environment.getArgument("name");
final Category category = new Category(name);
if (environment.containsArgument("key")) {
category.setKey(environment.getArgument("key"));
}
getDao().save(category);
return category;
}
示例3: get
import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
@Override
public Snippet get(DataFetchingEnvironment environment) {
final Snippet snippet = new Snippet();
if (environment.containsArgument("key")) {
snippet.setKey(environment.getArgument("key"));
}
snippet.setTitle(environment.getArgument("title"));
snippet.setCategory(environment.getArgument("category"));
snippet.setBody(environment.getArgument("body"));
getDao().save(snippet);
return snippet;
}
示例4: getPaginationArguments
import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
public PaginationArguments getPaginationArguments(DataFetchingEnvironment environment) {
String cursor = "";
int count = DEFAULT_COUNT;
if (environment.containsArgument("cursor") && (environment.getArgument("cursor") instanceof String)) {
cursor = new String(DECODER.decode((String) environment.getArgument("cursor")), Charsets.UTF_8);
}
if (environment.containsArgument("count")) {
count = environment.getArgument("count");
}
ConfiguredFilter filter = null;
for (Map.Entry<String, CollectionFilter> entry : collectionFilters.entrySet()) {
if (environment.containsArgument(entry.getKey())) {
String searchQuery = environment.getArgument(entry.getKey());
String cursorArg = cursor;
int countArg = count;
String dataSetId = ((DatabaseResult) environment.getSource()).getDataSet().getMetadata().getCombinedId();
String fieldName = environment.getFieldDefinition().getName();
filter = () -> entry.getValue().query(dataSetId, fieldName, searchQuery, cursorArg, countArg);
break;
}
}
return PaginationArguments.create(count, cursor, Optional.ofNullable(filter));
}