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

graphql.graphql-apigen.2.1.1.source-code.graphql-apigen.stg Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
// See https://github.com/antlr/stringtemplate4/blob/master/doc/groups.md
group apigen;

//////////////////////////////////////////////////////////////////////
// Define the objectType builder:
objectTypeFileName(model) ::= ".java"
objectTypeGenerator(model) ::= <<
package ;

;}>

import java.util.List;


public interface  {
    public static class Builder {


        private  _;
}>
        public Builder() {}
        public Builder( src) {


            _ = src.get();
}>
        }



        public Builder with( _) {
            this._ = _;
            return this;
        \}
}>
        public  build() {
            return new Impl(this);
        }
    }
    public static class Impl implements  {


        private  _;
}>
        protected Impl(Builder builder) {


            this._ = builder._;
}>
        }


        @Override
        public  get() {
            return _;
        \}
}>
        @Override
        public String toString() {
            return "{"


                 + ", =" + _
}>

                 + "}";
        }
        // TODO: equals(Object) & hashCode()
    }

    public static class Unresolved implements  {
        private  _id;
        public Unresolved( id) {
            this._id = id;
        }
        @Override
        public  getId() {
            return _id;
        }
        @Override
        public String toString() {
            return ".Unresolved{"
                 + "id=" + _id
                 + "}";
        }
    }
    public static interface Resolver extends com.distelli.graphql.Resolver\<\> {
        public List\<\> resolve(List\<\> list);
    }


    // TODO: extend any implemented interfaces...
    interface Args {
 get() { return null; \}}>
    \}
    public default  (Args args) { return null; \}

    public default  get() { return null; \}
}>
}

>>

//////////////////////////////////////////////////////////////////////
// Define the object TypeProvider
objectTypeProviderFileName(model) ::= "TypeProvider.java"
objectTypeProviderGenerator(model) ::= <<
package ;

;}>
import com.distelli.graphql.MethodDataFetcher;
import com.distelli.graphql.ResolverDataFetcher;
import graphql.Scalars;
import graphql.schema.*;
import java.util.Arrays;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Named;
import java.util.Optional;

@Named
public class TypeProvider implements Provider\ {

    @Inject
    private Optional\<\> ;
}>
    @Inject
    private Optional\<\> _impl;
    @Inject
    protected TypeProvider() {}
    @Override
    public GraphQLObjectType get() {
        return GraphQLObjectType.newObject()
            .name("")
)
                .name("")

                .argument(Arrays.asList(
")
                    .type()

                    .defaultValue()

                    .build()}; separator=",\n">))


                .dataFetcher(new ResolverDataFetcher(
                      new MethodDataFetcher(
                          "",
                          .Args.classnull,
                          _impl.orElse(null)),
                      .orElse(null),
                      ))

                .dataFetcher(new MethodDataFetcher(
                    "",
                    .Args.classnull,
                    _impl.orElse(null)))

                .build())}>
            .build();
    }
}

>>
objectTypeProviderGuiceModule(model) ::= <<
        types.addBinding("")
             .toProvider(.TypeProvider.class);
        OptionalBinder.newOptionalBinder(binder(), ..class);

        OptionalBinder.newOptionalBinder(binder(), ..Resolver.class);


>>

//////////////////////////////////////////////////////////////////////
// Define the inputObjectType builder:
inputObjectTypeFileName(model) ::= ".java"
inputObjectTypeGenerator(model) ::= <<
package ;

;}>

public interface  {
    public static class Builder {
 _;}>
        public Builder() {}
        public Builder( src) {
 = src.get();}>
        }

( _) {
            this._ = _;
            return this;
        \}}>
        public  build() {
            return new Impl(this);
        }
    }
    public static class Impl implements  {
 _;}>
        protected Impl(Builder builder) {
 = builder._;}>
        }
 get() {
            return _;
        \}}>
        @Override
        public String toString() {
            return "{"
, =" + _}>

                 + "}";
        }
        // TODO: equals(Object) & hashCode()
    }
 get() { return null; \}}>
}

>>
//////////////////////////////////////////////////////////////////////
// Define the object TypeProvider
inputObjectTypeProviderFileName(model) ::= "TypeProvider.java"
inputObjectTypeProviderGenerator(model) ::= <<
package ;

;}>
import com.distelli.graphql.MethodDataFetcher;
import com.distelli.graphql.ResolverDataFetcher;
import graphql.Scalars;
import graphql.schema.*;
import java.util.Arrays;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Named;

@Named
public class TypeProvider implements Provider\ {
    @Inject
    protected TypeProvider() {}
    @Override
    public GraphQLInputObjectType get() {
        return GraphQLInputObjectType.newInputObject()
            .name("")
)
                .name("")

                .defaultValue()

                .build())}>
            .build();
    }
}

>>
inputObjectTypeProviderGuiceModule(model) ::= <<
        types.addBinding("")
             .toProvider(.TypeProvider.class);
        OptionalBinder.newOptionalBinder(binder(), ..class);

>>

//////////////////////////////////////////////////////////////////////
// Define the GuiceModule:
guiceModule(packageName, className, configure) ::= <<
package ;
import com.google.inject.AbstractModule;
import com.google.inject.multibindings.MapBinder;
import com.google.inject.multibindings.OptionalBinder;
import graphql.schema.GraphQLType;

public class  extends AbstractModule {
    protected void configure() {
        MapBinder\ types =
            MapBinder.newMapBinder(binder(), String.class, GraphQLType.class);
        
    }
}

>>

//////////////////////////////////////////////////////////////////////
// Define the interface builder:
interfaceFileName(model) ::= ".java"
interfaceGenerator(model) ::= <<
package ;

;}>

public interface  {
Args {
 get() { return null; \}}>
    \}
    public default  (Args args) {
        return null;
    \}}>

    interface Args {
 get();}>
    \}
    public  (Args args);

    public  get();
}>
}

>>

//////////////////////////////////////////////////////////////////////
// Define the enum builder:
enumFileName(model) ::= ".java"
enumGenerator(model) ::= <<
package ;

;}>

public enum  {
,}>
}

>>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy