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

The newest version!
package io.smallrye.graphql.client.core;

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

import java.util.List;

import io.smallrye.graphql.client.core.factory.InlineFragmentFactory;

/**
 * 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 = getNewInstanceFromFactory(InlineFragmentFactory.class);

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

        return fragment;
    }

    static InlineFragment on(String type, List directives, FieldOrFragment... fields) {
        InlineFragment fragment = getNewInstanceFromFactory(InlineFragmentFactory.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 - 2025 Weber Informatics LLC | Privacy Policy