|
1 | 1 | package graphql.scalars;
|
2 | 2 |
|
3 | 3 | import graphql.PublicApi;
|
4 |
| -import graphql.scalars.datetime.DateTimeScalar; |
5 | 4 | import graphql.scalars.datetime.DateScalar;
|
| 5 | +import graphql.scalars.datetime.DateTimeScalar; |
6 | 6 | import graphql.scalars.datetime.TimeScalar;
|
7 | 7 | import graphql.scalars.numeric.NegativeFloatScalar;
|
8 | 8 | import graphql.scalars.numeric.NegativeIntScalar;
|
|
17 | 17 | import graphql.scalars.url.UrlScalar;
|
18 | 18 | import graphql.schema.GraphQLScalarType;
|
19 | 19 |
|
| 20 | +/** |
| 21 | + * This is the API entry point for all the extended scalars |
| 22 | + */ |
20 | 23 | @PublicApi
|
21 | 24 | public class ExtendedScalars {
|
22 | 25 |
|
23 |
| - |
| 26 | + /** |
| 27 | + * An RFC-3339 compliant date time scalar that accepts string values like `1996-12-19T16:39:57-08:00` and produces |
| 28 | + * `java.time.OffsetDateTime` objects at runtime. |
| 29 | + * <p> |
| 30 | + * Its {@link graphql.schema.Coercing#serialize(java.lang.Object)} and {@link graphql.schema.Coercing#parseValue(java.lang.Object)} methods |
| 31 | + * accept OffsetDateTime, ZoneDateTime and formatted Strings as valid objects. |
| 32 | + * <p> |
| 33 | + * See the <a href="https://www.ietf.org/rfc/rfc3339.txt">rfc3339 spec</a> for more details on the format. |
| 34 | + * |
| 35 | + * @see java.time.OffsetDateTime |
| 36 | + * @see java.time.ZonedDateTime |
| 37 | + */ |
24 | 38 | public static GraphQLScalarType DateTime = new DateTimeScalar();
|
| 39 | + |
| 40 | + /** |
| 41 | + * An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces |
| 42 | + * `java.time.LocalDate` objects at runtime. |
| 43 | + * <p> |
| 44 | + * Its {@link graphql.schema.Coercing#serialize(java.lang.Object)} and {@link graphql.schema.Coercing#parseValue(java.lang.Object)} methods |
| 45 | + * accept date {@link java.time.temporal.TemporalAccessor}s and formatted Strings as valid objects. |
| 46 | + * <p> |
| 47 | + * See the <a href="https://www.ietf.org/rfc/rfc3339.txt">rfc3339 spec</a> for more details on the format. |
| 48 | + * |
| 49 | + * @see java.time.LocalDate |
| 50 | + */ |
25 | 51 | public static GraphQLScalarType Date = new DateScalar();
|
| 52 | + /** |
| 53 | + * An RFC-3339 compliant time scalar that accepts string values like `6:39:57-08:00` and produces |
| 54 | + * `java.time.OffsetTime` objects at runtime. |
| 55 | + * <p> |
| 56 | + * Its {@link graphql.schema.Coercing#serialize(java.lang.Object)} and {@link graphql.schema.Coercing#parseValue(java.lang.Object)} methods |
| 57 | + * accept time {@link java.time.temporal.TemporalAccessor}s and formatted Strings as valid objects. |
| 58 | + * <p> |
| 59 | + * See the <a href="https://www.ietf.org/rfc/rfc3339.txt">rfc3339 spec</a> for more details on the format. |
| 60 | + * |
| 61 | + * @see java.time.OffsetTime |
| 62 | + */ |
26 | 63 | public static GraphQLScalarType Time = new TimeScalar();
|
27 | 64 |
|
28 | 65 | /**
|
@@ -62,20 +99,63 @@ public class ExtendedScalars {
|
62 | 99 | * }
|
63 | 100 | * }
|
64 | 101 | * </pre>
|
| 102 | + * |
| 103 | + * @see graphql.scalars.ExtendedScalars#Object |
65 | 104 | */
|
66 | 105 | public static GraphQLScalarType Json = new JsonScalar();
|
67 | 106 |
|
| 107 | + /** |
| 108 | + * A URL scalar that accepts URL strings and produces {@link java.net.URL} objects at runtime |
| 109 | + */ |
68 | 110 | public static GraphQLScalarType Url = new UrlScalar();
|
69 | 111 |
|
| 112 | + /** |
| 113 | + * An `Int` scalar that MUST be greater than zero |
| 114 | + * |
| 115 | + * @see graphql.Scalars#GraphQLInt |
| 116 | + */ |
70 | 117 | public static GraphQLScalarType PositiveInt = new PositiveIntScalar();
|
| 118 | + /** |
| 119 | + * An `Int` scalar that MUST be less than zero |
| 120 | + * |
| 121 | + * @see graphql.Scalars#GraphQLInt |
| 122 | + */ |
71 | 123 | public static GraphQLScalarType NegativeInt = new NegativeIntScalar();
|
| 124 | + /** |
| 125 | + * An `Int` scalar that MUST be less than or equal to zero |
| 126 | + * |
| 127 | + * @see graphql.Scalars#GraphQLInt |
| 128 | + */ |
72 | 129 | public static GraphQLScalarType NonPositiveInt = new NonPositiveIntScalar();
|
| 130 | + /** |
| 131 | + * An `Int` scalar that MUST be greater than or equal to zero |
| 132 | + * |
| 133 | + * @see graphql.Scalars#GraphQLInt |
| 134 | + */ |
73 | 135 | public static GraphQLScalarType NonNegativeInt = new NonNegativeIntScalar();
|
74 | 136 |
|
| 137 | + /** |
| 138 | + * An `Float` scalar that MUST be greater than zero |
| 139 | + * |
| 140 | + * @see graphql.Scalars#GraphQLFloat |
| 141 | + */ |
75 | 142 | public static GraphQLScalarType PositiveFloat = new PositiveFloatScalar();
|
| 143 | + /** |
| 144 | + * An `Float` scalar that MUST be less than zero |
| 145 | + * |
| 146 | + * @see graphql.Scalars#GraphQLFloat |
| 147 | + */ |
76 | 148 | public static GraphQLScalarType NegativeFloat = new NegativeFloatScalar();
|
| 149 | + /** |
| 150 | + * An `Float` scalar that MUST be less than or equal to zero |
| 151 | + * |
| 152 | + * @see graphql.Scalars#GraphQLFloat |
| 153 | + */ |
77 | 154 | public static GraphQLScalarType NonPositiveFloat = new NonPositiveFloatScalar();
|
| 155 | + /** |
| 156 | + * An `Float` scalar that MUST be greater than or equal to zero |
| 157 | + * |
| 158 | + * @see graphql.Scalars#GraphQLFloat |
| 159 | + */ |
78 | 160 | public static GraphQLScalarType NonNegativeFloat = new NonNegativeFloatScalar();
|
79 |
| - |
80 |
| - |
81 | 161 | }
|
0 commit comments