All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.smallrye.graphql.client.core.InlineFragment Maven / Gradle / Ivy

Go to download

SmallRye specific Client API, extending the MicroProfile client api, allowing us to play with the api first before we move it to the spec

There is a newer version: 2.11.0
Show newest version
package io.smallrye.graphql.client.core;

import static io.smallrye.graphql.client.core.utils.ServiceUtils.getNewInstanceOf;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;

import java.util.List;

/**
 * Represents an inline fragment in a GraphQL document. This can be used
 * anywhere where a field is expected (thus it implements `FieldOrFragment`).
 */
public interface InlineFragment extends FieldOrFragment {

    static InlineFragment on(String type, FieldOrFragment... fields) {
        InlineFragment fragment = getNewInstanceOf(InlineFragment.class);

        fragment.setType(type);
        fragment.setDirectives(emptyList());
        fragment.setFields(asList(fields));

        return fragment;
    }

    static InlineFragment on(String type, List directives, FieldOrFragment... fields) {
        InlineFragment fragment = getNewInstanceOf(InlineFragment.class);

        fragment.setType(type);
        fragment.setDirectives(directives);
        fragment.setFields(asList(fields));

        return fragment;
    }

    static InlineFragment on(FieldOrFragment... fields) {
        return on("", fields);
    }

    static InlineFragment on(List directives, FieldOrFragment... fields) {
        return on("", directives, fields);
    }

    String getType();

    void setType(String name);

    List getFields();

    void setFields(List fields);

    List getDirectives();

    void setDirectives(List directives);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy