|
| 1 | +/** |
| 2 | + * Copyright 2016 Yurii Rashkovskii |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + */ |
| 15 | +package graphql.annotations.directives; |
| 16 | + |
| 17 | +import graphql.schema.*; |
| 18 | + |
| 19 | +public interface AnnotationsDirectiveWiring { |
| 20 | + /** |
| 21 | + * This is called when an object is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 22 | + * of that DSL element |
| 23 | + * |
| 24 | + * @param environment the wiring element |
| 25 | + * |
| 26 | + * @return a non null element based on the original one |
| 27 | + */ |
| 28 | + default GraphQLObjectType onObject(AnnotationsWiringEnvironment environment) { |
| 29 | + return (GraphQLObjectType) environment.getElement(); |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * This is called when a field is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 34 | + * of that DSL element |
| 35 | + * |
| 36 | + * @param environment the wiring element |
| 37 | + * |
| 38 | + * @return a non null element based on the original one |
| 39 | + */ |
| 40 | + default GraphQLFieldDefinition onField(AnnotationsWiringEnvironment environment) { |
| 41 | + return (GraphQLFieldDefinition) environment.getElement(); |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * This is called when an argument is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 46 | + * of that DSL element |
| 47 | + * |
| 48 | + * @param environment the wiring element |
| 49 | + * |
| 50 | + * @return a non null element based on the original one |
| 51 | + */ |
| 52 | + default GraphQLArgument onArgument(AnnotationsWiringEnvironment environment) { |
| 53 | + return (GraphQLArgument) environment.getElement(); |
| 54 | + } |
| 55 | + |
| 56 | + /** |
| 57 | + * This is called when an interface is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 58 | + * of that DSL element |
| 59 | + * |
| 60 | + * @param environment the wiring element |
| 61 | + * |
| 62 | + * @return a non null element based on the original one |
| 63 | + */ |
| 64 | + default GraphQLInterfaceType onInterface(AnnotationsWiringEnvironment environment) { |
| 65 | + return (GraphQLInterfaceType) environment.getElement(); |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * This is called when a union is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 70 | + * of that DSL element |
| 71 | + * |
| 72 | + * @param environment the wiring element |
| 73 | + * |
| 74 | + * @return a non null element based on the original one |
| 75 | + */ |
| 76 | + default GraphQLUnionType onUnion(AnnotationsWiringEnvironment environment) { |
| 77 | + return (GraphQLUnionType) environment.getElement(); |
| 78 | + } |
| 79 | + |
| 80 | + /** |
| 81 | + * This is called when an enum is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 82 | + * of that DSL element |
| 83 | + * |
| 84 | + * @param environment the wiring element |
| 85 | + * |
| 86 | + * @return a non null element based on the original one |
| 87 | + */ |
| 88 | + default GraphQLEnumType onEnum(AnnotationsWiringEnvironment environment) { |
| 89 | + return (GraphQLEnumType) environment.getElement(); |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * This is called when an enum value is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 94 | + * of that DSL element |
| 95 | + * |
| 96 | + * @param environment the wiring element |
| 97 | + * |
| 98 | + * @return a non null element based on the original one |
| 99 | + */ |
| 100 | + default GraphQLEnumValueDefinition onEnumValue(AnnotationsWiringEnvironment environment) { |
| 101 | + return (GraphQLEnumValueDefinition) environment.getElement(); |
| 102 | + } |
| 103 | + |
| 104 | + /** |
| 105 | + * This is called when a custom scalar is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 106 | + * of that DSL element |
| 107 | + * |
| 108 | + * @param environment the wiring element |
| 109 | + * |
| 110 | + * @return a non null element based on the original one |
| 111 | + */ |
| 112 | + default GraphQLScalarType onScalar(AnnotationsWiringEnvironment environment) { |
| 113 | + return (GraphQLScalarType) environment.getElement(); |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * This is called when an input object is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 118 | + * of that DSL element |
| 119 | + * |
| 120 | + * @param environment the wiring element |
| 121 | + * |
| 122 | + * @return a non null element based on the original one |
| 123 | + */ |
| 124 | + default GraphQLInputObjectType onInputObjectType(AnnotationsWiringEnvironment environment) { |
| 125 | + return (GraphQLInputObjectType) environment.getElement(); |
| 126 | + } |
| 127 | + |
| 128 | + /** |
| 129 | + * This is called when an input object field is encountered, which gives the schema directive a chance to modify the shape and behaviour |
| 130 | + * of that DSL element |
| 131 | + * |
| 132 | + * @param environment the wiring element |
| 133 | + * |
| 134 | + * @return a non null element based on the original one |
| 135 | + */ |
| 136 | + default GraphQLInputObjectField onInputObjectField(AnnotationsWiringEnvironment environment) { |
| 137 | + return (GraphQLInputObjectField) environment.getElement(); |
| 138 | + } |
| 139 | +} |
0 commit comments