• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SchemaParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中graphql.schema.idl.SchemaParser的典型用法代码示例。如果您正苦于以下问题:Java SchemaParser类的具体用法?Java SchemaParser怎么用?Java SchemaParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SchemaParser类属于graphql.schema.idl包,在下文中一共展示了SchemaParser类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: HGQLConfig

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
public HGQLConfig(String propertyFilepath) {

        ObjectMapper mapper = new ObjectMapper();

        try {
            HGQLConfig config = mapper.readValue(new File(propertyFilepath), HGQLConfig.class);

            SchemaParser schemaParser = new SchemaParser();
            this.registry = schemaParser.parse(new File(config.schemaFile));

            this.name = config.name;
            this.schemaFile = config.schemaFile;
            this.serviceConfigs = config.serviceConfigs;
            this.graphqlConfig = config.graphqlConfig;
            HGQLSchemaWiring wiring = new HGQLSchemaWiring(this.registry,this.name,this.serviceConfigs);
            this.schema = wiring.getSchema();
            this.hgqlSchema = wiring.getHgqlSchema();

        } catch (IOException e) {
            logger.error(e);
        }


    }
 
开发者ID:semantic-integration,项目名称:hypergraphql,代码行数:25,代码来源:HGQLConfig.java


示例2: setUp

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    // Set up dummy data
    categoryJdbcDao = new JdbcDao<>(new CategoryConfiguration(testDatabase.getDatabase()));
    categoryJdbcDao.save(CATEGORY_A);
    categoryJdbcDao.save(CATEGORY_B);

    snippetJdbcDao = new JdbcDao<>(new SnippetConfiguration(testDatabase.getDatabase()));
    snippetJdbcDao.save(SNIPPET_A_ONE);
    snippetJdbcDao.save(SNIPPET_A_TWO);
    snippetJdbcDao.save(SNIPPET_B_THREE);
    snippetJdbcDao.save(SNIPPET_B_FOUR);

    // Setup GraphQL
    SchemaParser schemaParser = new SchemaParser();
    final InputStream inputStream = getClass().getClassLoader().getResourceAsStream("snippets.graphqls");
    final InputStreamReader streamReader = new InputStreamReader(inputStream);
    final TypeDefinitionRegistry registry = schemaParser.parse(streamReader);
    final RuntimeWiring wiring = RuntimeWiringBuilder.getRuntimeWiring(snippetJdbcDao, categoryJdbcDao);
    SchemaGenerator schemaGenerator = new SchemaGenerator();
    GraphQLSchema schema = schemaGenerator.makeExecutableSchema(registry, wiring);
    graphQL = GraphQL.newGraphQL(schema).build();
}
 
开发者ID:nwillc,项目名称:mysnipserver,代码行数:24,代码来源:GraphQLTest.java


示例3: assertScriptFormat

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
@Test
public void assertScriptFormat() {
    SchemaParser schemaParser = new SchemaParser();
    SchemaGenerator schemaGenerator = new SchemaGenerator();

    TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry();
    typeRegistry.merge(schemaParser.parse(loadSchema("common.graphqls")));
    typeRegistry.merge(schemaParser.parse(loadSchema("trace.graphqls")));
    typeRegistry.merge(schemaParser.parse(loadSchema("overview-layer.graphqls")));
    typeRegistry.merge(schemaParser.parse(loadSchema("application-layer.graphqls")));
    typeRegistry.merge(schemaParser.parse(loadSchema("server-layer.graphqls")));
    typeRegistry.merge(schemaParser.parse(loadSchema("service-layer.graphqls")));
    typeRegistry.merge(schemaParser.parse(loadSchema("alarm.graphqls")));
    typeRegistry.merge(schemaParser.parse(loadSchema("config.graphqls")));
    RuntimeWiring wiring = buildRuntimeWiring();
    assertTrue(schemaGenerator.makeExecutableSchema(typeRegistry, wiring).getAllTypesAsList().size() > 0);
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:18,代码来源:GraphQLScriptTest.java


示例4: getGraphQL

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
public GraphQL getGraphQL() {
	SchemaParser schemaParser = new SchemaParser();
	SchemaGenerator schemaGenerator = new SchemaGenerator();
	
	InputStream inputStream = CartSchemaBuilder.class.getResourceAsStream("/graphql/schema/cart.graphqls");
	Reader schemaFile = new InputStreamReader(inputStream);
	TypeDefinitionRegistry typeRegistry = schemaParser.parse(schemaFile);
	RuntimeWiring wiring = buildRuntimeWiring();
	GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeRegistry, wiring);
	
	return GraphQL.newGraphQL(graphQLSchema).build();
}
 
开发者ID:ERS-HCL,项目名称:cart-cqrs-demo,代码行数:13,代码来源:CartSchemaBuilder.java


示例5: fromString

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
@Override
public GraphQLSchema fromString(String schemaString, RuntimeWiring runtimeWiring) {
	SchemaParser schemaParser = new SchemaParser();
	TypeDefinitionRegistry typeRegistry = schemaParser.parse(schemaString);
	RuntimeWiring wiring = runtimeWiring;
	SchemaGenerator schemaGenerator = new SchemaGenerator();
	return schemaGenerator.makeExecutableSchema(typeRegistry, wiring);
}
 
开发者ID:tibor-kocsis,项目名称:vertx-graphql-utils,代码行数:9,代码来源:IDLSchemaParserImpl.java


示例6: GraphQLHandler

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
public GraphQLHandler() throws Exception {
    final SchemaParser schemaParser = new SchemaParser();
    final TypeDefinitionRegistry registry;
    try (final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(GRAPHQL_SCHEMA_IDL);
         final InputStreamReader streamReader = new InputStreamReader(inputStream)) {
        registry = schemaParser.parse(streamReader);
    } catch (Exception e) {
        throw new IllegalStateException("Could not parse graphql schema", e);
    }
    final RuntimeWiring wiring = RuntimeWiringFactory.getRuntimeWiring(companies);
    SchemaGenerator schemaGenerator = new SchemaGenerator();
    graphql = GraphQL.newGraphQL(schemaGenerator.makeExecutableSchema(registry, wiring)).build();
}
 
开发者ID:nwillc,项目名称:ratpack-graphql,代码行数:14,代码来源:GraphQLHandler.java


示例7: buildSchema

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
private GraphQLSchema buildSchema() {
    //
    // reads a file that provides the schema types
    //
    Reader streamReader = loadSchemaFile("stocks.graphqls");
    TypeDefinitionRegistry typeRegistry = new SchemaParser().parse(streamReader);

    RuntimeWiring wiring = RuntimeWiring.newRuntimeWiring()
            .type(newTypeWiring("Subscription")
                    .dataFetcher("stockQuotes", stockQuotesSubscriptionFetcher())
            )
            .build();

    return new SchemaGenerator().makeExecutableSchema(typeRegistry, wiring);
}
 
开发者ID:graphql-java,项目名称:graphql-java-subscription-example,代码行数:16,代码来源:StockTickerGraphqlPublisher.java


示例8: loadSchema

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
@PostConstruct
public void loadSchema() throws IOException{
    Resource schemaResource = new ClassPathResource("/demo-schema.graphqls");
    TypeDefinitionRegistry typeDefinitionRegistry = new SchemaParser().parse(new InputStreamReader(schemaResource.getInputStream()));
    RuntimeWiring runtimeWiring = buildRuntimeWiring();
    GraphQLSchema graphQLSchema = new SchemaGenerator().makeExecutableSchema(typeDefinitionRegistry,runtimeWiring);
    graphQL = GraphQL.newGraphQL(graphQLSchema).build();
}
 
开发者ID:rylitalo,项目名称:graphql-with-springboot-jpa-example,代码行数:9,代码来源:GraphQLQueryController.java


示例9: build

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
public GraphQLSchema build() throws SchemaProblem, URISyntaxException {
    final SchemaParser parser = new SchemaParser();
    final TypeDefinitionRegistry registry = parser.parse(getSchemaFile());

    final SchemaGenerator generator = new SchemaGenerator();
    final GraphQLSchema schema = generator.makeExecutableSchema(registry,
            runtimeWiring);
    return schema;
}
 
开发者ID:smoketurner,项目名称:dropwizard-graphql,代码行数:10,代码来源:GraphQLFactory.java


示例10: GraphQLHandler

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
@Inject
public GraphQLHandler(Dao<String, Category> categoriesDao,
                      Dao<String, Snippet> snippetDao) {
    final SchemaParser schemaParser = new SchemaParser();
    final TypeDefinitionRegistry registry;
    try (final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(GRAPHQL_SCHEMA_IDL);
         final InputStreamReader streamReader = new InputStreamReader(inputStream)) {
        registry = schemaParser.parse(streamReader);
    } catch (Exception e) {
        throw new IllegalStateException("Could not parse graphql schema", e);
    }
    final RuntimeWiring wiring = RuntimeWiringBuilder.getRuntimeWiring(snippetDao, categoriesDao);
    SchemaGenerator schemaGenerator = new SchemaGenerator();
    graphql = GraphQL.newGraphQL(schemaGenerator.makeExecutableSchema(registry, wiring)).build();
}
 
开发者ID:nwillc,项目名称:mysnipserver,代码行数:16,代码来源:GraphQLHandler.java


示例11: RootQuery

import graphql.schema.idl.SchemaParser; //导入依赖的package包/类
public RootQuery(DataSetRepository dataSetRepository, SupportedExportFormats supportedFormats, String archetypes,
                 RdfWiringFactory wiringFactory, DerivedSchemaTypeGenerator typeGenerator, ObjectMapper objectMapper)
  throws IOException {
  this.dataSetRepository = dataSetRepository;
  this.supportedFormats = supportedFormats;
  this.archetypes = archetypes;
  this.wiringFactory = wiringFactory;
  this.typeGenerator = typeGenerator;
  this.objectMapper = objectMapper;
  staticQuery = Resources.toString(getResource(RootQuery.class, "schema.graphql"), Charsets.UTF_8);
  schemaParser = new SchemaParser();
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:13,代码来源:RootQuery.java



注:本文中的graphql.schema.idl.SchemaParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AttributeInstance类代码示例发布时间:2022-05-22
下一篇:
Java RMDelegationTokenSecretManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap