org.eclipse.microprofile.graphql.Source Java Examples

The following examples show how to use org.eclipse.microprofile.graphql.Source. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HeroFinder.java    From microprofile-graphql with Apache License 2.0 5 votes vote down vote up
@Name("secretToken")
public Token generateSecretToken(@Source SuperHero hero,
                                  @DefaultValue("true") 
                                  @Name("maskFirstPart") boolean maskFirstPart) throws GraphQLException {
    LOG.log(Level.INFO, "generateSecretToken invoked [{0}],[{1}]", new Object[]{hero,maskFirstPart});
    
    String uuid = UUID.randomUUID().toString();
    if(maskFirstPart){
        return new Token(uuid.substring(0,uuid.length()-4).replaceAll("[A-Za-z0-9]", "*") + uuid.substring(uuid.length()-4,uuid.length()));
    }else{
        return new Token(uuid);
    }
}
 
Example #2
Source File: HeroFinder.java    From microprofile-graphql with Apache License 2.0 5 votes vote down vote up
@Query
public String getCurrentLocation(@Name("superHero")@Source SuperHero hero) throws GraphQLException {
    LOG.log(Level.INFO, "currentLocation invoked [{0}]", hero);
    final String heroName = hero.getName();
    return heroLocator.getHeroLocation(heroName)
            .orElseThrow(() -> {
                return new GraphQLException("Cannot find location for " + heroName,
                        GraphQLException.ExceptionType.DataFetchingException);
            });
}
 
Example #3
Source File: AdditionalDurationScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public Duration durationDefault(@Source AdditionalDurationScalars additionalDurationScalars,
        @DefaultValue("PT1H2M3S") Duration duration) {
    return duration;
}
 
Example #4
Source File: TestResource.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public TestRandom getRandomNumber(@Source TestPojo testPojo) {
    return new TestRandom(123);
}
 
Example #5
Source File: AdditionalDurationScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public Period periodInput(@Source AdditionalDurationScalars additionalDurationScalars, Period period) {
    return period;
}
 
Example #6
Source File: AdditionalDurationScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public Period periodDefault(@Source AdditionalDurationScalars additionalDurationScalars,
        @DefaultValue("P1Y2M3D") Period period) {
    return period;
}
 
Example #7
Source File: AdditionalScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public URL urlInput(@Source AdditionalScalars additionalScalars, URL url) {
    return url;
}
 
Example #8
Source File: AdditionalScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public URI uriInput(@Source AdditionalScalars additionalScalars, URI uri) {
    return uri;
}
 
Example #9
Source File: AdditionalScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public UUID uuidInput(@Source AdditionalScalars additionalScalars, UUID uuid) {
    return uuid;
}
 
Example #10
Source File: AdditionalScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public URL urlDefault(@Source AdditionalScalars additionalScalars, @DefaultValue("https://example.com") URL url) {
    return url;
}
 
Example #11
Source File: AdditionalScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public URI uriDefault(@Source AdditionalScalars additionalScalars, @DefaultValue("https://example.com") URI uri) {
    return uri;
}
 
Example #12
Source File: AdditionalScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public UUID uuidDefault(@Source AdditionalScalars additionalScalars,
        @DefaultValue("037f4ba2-6d74-4686-a4ea-90cbd86007c3") UUID uuid) {
    return uuid;
}
 
Example #13
Source File: AsyncApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public CompletableFuture<String> asyncString(@Source AsyncSource asyncSource) {
    return CompletableFuture.completedFuture("asyncString");
}
 
Example #14
Source File: AsyncApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public CompletableFuture<List<Integer>> asyncList(@Source AsyncSource asyncSource) {
    return CompletableFuture.completedFuture(Arrays.asList(1, 2, 3));
}
 
Example #15
Source File: AsyncApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public CompletableFuture<LocalDate> asyncLocalDate(@Source AsyncSource asyncSource) {
    return CompletableFuture.completedFuture(LocalDate.parse("2006-01-02"));
}
 
Example #16
Source File: AsyncApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
@DateFormat("MM/dd/yyyy")
public CompletableFuture<LocalDate> asyncFormattedLocalDate(@Source AsyncSource asyncSource) {
    return CompletableFuture.completedFuture(LocalDate.parse("2006-01-02"));
}
 
Example #17
Source File: AsyncApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
@NonNull
public CompletableFuture<String> asyncNonNullString(@Source AsyncSource asyncSource) {
    return CompletableFuture.completedFuture("asyncNonNullString");
}
 
Example #18
Source File: AsyncApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public CompletableFuture<String> asyncWithGraphQLException(@Source AsyncSource asyncSource) {
    CompletableFuture<String> future = new CompletableFuture<>();
    future.completeExceptionally(new GraphQLException("Some Exception"));
    return future;
}
 
Example #19
Source File: FilmResource.java    From quarkus-quickstarts with Apache License 2.0 4 votes vote down vote up
public List<Hero> heroes(@Source Film film) {
    return service.getHeroesByFilm(film);
}
 
Example #20
Source File: DummyGraphQLApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
@Name("description")
public String source(@Source Foo foo) {
    return "Awesome";
}
 
Example #21
Source File: CharApi.java    From microprofile-graphql with Apache License 2.0 4 votes vote down vote up
public char charPrimitiveInput(@Source CharHolder charHolder, char c) {
    return c;
}
 
Example #22
Source File: CharApi.java    From microprofile-graphql with Apache License 2.0 4 votes vote down vote up
public char[] charArrayInput(@Source CharHolder charHolder, char[] cs) {
    return cs;
}
 
Example #23
Source File: CharApi.java    From microprofile-graphql with Apache License 2.0 4 votes vote down vote up
public Character charObjectInput(@Source CharHolder charHolder, Character c) {
    return c;
}
 
Example #24
Source File: SourceTestApi.java    From microprofile-graphql with Apache License 2.0 4 votes vote down vote up
public String stringInput(@Source SourceType source, String input) {
    return "Input was: " + input;
}
 
Example #25
Source File: SourceTestApi.java    From microprofile-graphql with Apache License 2.0 4 votes vote down vote up
public String nonNullStringInput(@Source SourceType source, @NonNull String input) {
    return "Input was: " + input;
}
 
Example #26
Source File: SourceTestApi.java    From microprofile-graphql with Apache License 2.0 4 votes vote down vote up
public String namedStringInput(@Source SourceType source, @Name("in") String input) {
    return "Input was: " + input;
}
 
Example #27
Source File: SourceTestApi.java    From microprofile-graphql with Apache License 2.0 4 votes vote down vote up
public String defaultStringInput(@Source SourceType source, @DefaultValue("Default value") String input) {
    return "Input was: " + input;
}
 
Example #28
Source File: SourceTestApi.java    From microprofile-graphql with Apache License 2.0 4 votes vote down vote up
public String dateInput(@Source SourceType source, @DateFormat(value = "yyyy-MM-dd") LocalDate input) {
    return "Input was: " + (input != null ? input.format(DateTimeFormatter.ISO_DATE) : null);
}
 
Example #29
Source File: AdditionalDurationScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public Duration durationInput(@Source AdditionalDurationScalars additionalDurationScalars, Duration duration) {
    return duration;
}
 
Example #30
Source File: AdditionalDateScalarsApi.java    From smallrye-graphql with Apache License 2.0 4 votes vote down vote up
public java.util.Date dateInput(@Source AdditionalDateScalars additionalDateScalars, java.util.Date date) {
    return date;
}