Class ExtendedScalars


  • @PublicApi
    public class ExtendedScalars
    extends java.lang.Object
    This is the API entry point for all the extended scalars
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static graphql.schema.GraphQLScalarType CountryCode
      The CountryCode scalar type as defined by ISO 3166-1 alpha-2.
      static graphql.schema.GraphQLScalarType Currency
      A field whose value is an ISO-4217 currency.
      static graphql.schema.GraphQLScalarType Date
      An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java.time.LocalDate` objects at runtime.
      static graphql.schema.GraphQLScalarType DateTime
      An RFC-3339 compliant date time scalar that accepts string values like `1996-12-19T16:39:57-08:00` and produces `java.time.OffsetDateTime` objects at runtime.
      static graphql.schema.GraphQLScalarType GraphQLBigDecimal
      This represents the "BigDecimal" type which is a representation of java.math.BigDecimal
      static graphql.schema.GraphQLScalarType GraphQLBigInteger
      This represents the "BigInteger" type which is a representation of java.math.BigInteger
      static graphql.schema.GraphQLScalarType GraphQLByte
      This represents the "Byte" type which is a representation of java.lang.Byte
      static graphql.schema.GraphQLScalarType GraphQLChar
      This represents the "Char" type which is a representation of java.lang.Character
      static graphql.schema.GraphQLScalarType GraphQLLong
      This represents the "Long" type which is a representation of java.lang.Long
      static graphql.schema.GraphQLScalarType GraphQLShort
      This represents the "Short" type which is a representation of java.lang.Short
      static graphql.schema.GraphQLScalarType Json
      A synonym class for the Object scalar, since some people prefer their SDL to look like the following :
      static graphql.schema.GraphQLScalarType Locale
      A Locale scalar that accepts a IETF BCP 47 language tag string and produces Locale objects at runtime.
      static graphql.schema.GraphQLScalarType LocalTime
      A 24-hour local time scalar that accepts strings like `hh:mm:ss` and `hh:mm:ss.sss` and produces `java.time.LocalTime` objects at runtime.
      static graphql.schema.GraphQLScalarType NegativeFloat
      An `Float` scalar that MUST be less than zero
      static graphql.schema.GraphQLScalarType NegativeInt
      An `Int` scalar that MUST be less than zero
      static graphql.schema.GraphQLScalarType NonNegativeFloat
      An `Float` scalar that MUST be greater than or equal to zero
      static graphql.schema.GraphQLScalarType NonNegativeInt
      An `Int` scalar that MUST be greater than or equal to zero
      static graphql.schema.GraphQLScalarType NonPositiveFloat
      An `Float` scalar that MUST be less than or equal to zero
      static graphql.schema.GraphQLScalarType NonPositiveInt
      An `Int` scalar that MUST be less than or equal to zero
      static graphql.schema.GraphQLScalarType Object
      An object scalar allows you to have a multi level data value without defining it in the graphql schema.
      static graphql.schema.GraphQLScalarType PositiveFloat
      An `Float` scalar that MUST be greater than zero
      static graphql.schema.GraphQLScalarType PositiveInt
      An `Int` scalar that MUST be greater than zero
      static graphql.schema.GraphQLScalarType Time
      An RFC-3339 compliant time scalar that accepts string values like `6:39:57-08:00` and produces `java.time.OffsetTime` objects at runtime.
      static graphql.schema.GraphQLScalarType Url
      A URL scalar that accepts URL strings and produces URL objects at runtime
      static graphql.schema.GraphQLScalarType UUID
      A UUID scalar that accepts a universally unique identifier and produces UUID objects at runtime.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExtendedScalars()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static AliasedScalar.Builder newAliasedScalar​(java.lang.String name)
      This allows an existing scalar to be wrapped and aliased with a new name.
      static RegexScalar.Builder newRegexScalar​(java.lang.String name)
      A builder of a scalar that uses one or more regular expression Patterns to control the acceptable values for that scalar.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DateTime

        public static final graphql.schema.GraphQLScalarType DateTime
        An RFC-3339 compliant date time scalar that accepts string values like `1996-12-19T16:39:57-08:00` and produces `java.time.OffsetDateTime` objects at runtime.

        Its Coercing.serialize(java.lang.Object) and Coercing.parseValue(java.lang.Object) methods accept OffsetDateTime, ZoneDateTime and formatted Strings as valid objects.

        See the rfc3339 spec for more details on the format.

        See Also:
        OffsetDateTime, ZonedDateTime
      • Date

        public static final graphql.schema.GraphQLScalarType Date
        An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java.time.LocalDate` objects at runtime.

        Its Coercing.serialize(java.lang.Object) and Coercing.parseValue(java.lang.Object) methods accept date TemporalAccessors and formatted Strings as valid objects.

        See the rfc3339 spec for more details on the format.

        See Also:
        LocalDate
      • Time

        public static final graphql.schema.GraphQLScalarType Time
        An RFC-3339 compliant time scalar that accepts string values like `6:39:57-08:00` and produces `java.time.OffsetTime` objects at runtime.

        Its Coercing.serialize(java.lang.Object) and Coercing.parseValue(java.lang.Object) methods accept time TemporalAccessors and formatted Strings as valid objects.

        See the rfc3339 spec for more details on the format.

        See Also:
        OffsetTime
      • LocalTime

        public static final graphql.schema.GraphQLScalarType LocalTime
        A 24-hour local time scalar that accepts strings like `hh:mm:ss` and `hh:mm:ss.sss` and produces `java.time.LocalTime` objects at runtime.

        Its Coercing.serialize(java.lang.Object) and Coercing.parseValue(java.lang.Object) methods accept time TemporalAccessors and formatted Strings as valid objects.

        See Also:
        LocalTime
      • Object

        public static final graphql.schema.GraphQLScalarType Object
        An object scalar allows you to have a multi level data value without defining it in the graphql schema.

        It might be useful when you have opaque data coming from a backend system that you want to pass on but cant provide the actual graphql schema definition for.

        Use this with caution since is breaks one of the key benefits of graphql, which is that a schema describes the shape of the data that can be queried.

        This can be declared as follows :

         
        
         type Customer {
              name : String
              backendDetails : Object
         }
         
         
        See Also:
        Json
      • Json

        public static final graphql.schema.GraphQLScalarType Json
        A synonym class for the Object scalar, since some people prefer their SDL to look like the following :
         
        
         type Customer {
              name : String
              backendDetails : JSON
         }
         
         
        See Also:
        Object
      • Url

        public static final graphql.schema.GraphQLScalarType Url
        A URL scalar that accepts URL strings and produces URL objects at runtime
      • Locale

        public static final graphql.schema.GraphQLScalarType Locale
        A Locale scalar that accepts a IETF BCP 47 language tag string and produces Locale objects at runtime.
      • Currency

        public static final graphql.schema.GraphQLScalarType Currency
        A field whose value is an ISO-4217 currency. See the ISO-4217 for more details.
      • CountryCode

        public static final graphql.schema.GraphQLScalarType CountryCode
        The CountryCode scalar type as defined by ISO 3166-1 alpha-2. See the ISO 3166-1 alpha-2 for more details.
      • UUID

        public static graphql.schema.GraphQLScalarType UUID
        A UUID scalar that accepts a universally unique identifier and produces UUID objects at runtime.
      • PositiveInt

        public static final graphql.schema.GraphQLScalarType PositiveInt
        An `Int` scalar that MUST be greater than zero
        See Also:
        Scalars.GraphQLInt
      • NegativeInt

        public static final graphql.schema.GraphQLScalarType NegativeInt
        An `Int` scalar that MUST be less than zero
        See Also:
        Scalars.GraphQLInt
      • NonPositiveInt

        public static final graphql.schema.GraphQLScalarType NonPositiveInt
        An `Int` scalar that MUST be less than or equal to zero
        See Also:
        Scalars.GraphQLInt
      • NonNegativeInt

        public static final graphql.schema.GraphQLScalarType NonNegativeInt
        An `Int` scalar that MUST be greater than or equal to zero
        See Also:
        Scalars.GraphQLInt
      • PositiveFloat

        public static final graphql.schema.GraphQLScalarType PositiveFloat
        An `Float` scalar that MUST be greater than zero
        See Also:
        Scalars.GraphQLFloat
      • NegativeFloat

        public static final graphql.schema.GraphQLScalarType NegativeFloat
        An `Float` scalar that MUST be less than zero
        See Also:
        Scalars.GraphQLFloat
      • NonPositiveFloat

        public static final graphql.schema.GraphQLScalarType NonPositiveFloat
        An `Float` scalar that MUST be less than or equal to zero
        See Also:
        Scalars.GraphQLFloat
      • NonNegativeFloat

        public static final graphql.schema.GraphQLScalarType NonNegativeFloat
        An `Float` scalar that MUST be greater than or equal to zero
        See Also:
        Scalars.GraphQLFloat
      • GraphQLLong

        public static final graphql.schema.GraphQLScalarType GraphQLLong
        This represents the "Long" type which is a representation of java.lang.Long
      • GraphQLShort

        public static final graphql.schema.GraphQLScalarType GraphQLShort
        This represents the "Short" type which is a representation of java.lang.Short
      • GraphQLByte

        public static final graphql.schema.GraphQLScalarType GraphQLByte
        This represents the "Byte" type which is a representation of java.lang.Byte
      • GraphQLBigDecimal

        public static final graphql.schema.GraphQLScalarType GraphQLBigDecimal
        This represents the "BigDecimal" type which is a representation of java.math.BigDecimal
      • GraphQLBigInteger

        public static final graphql.schema.GraphQLScalarType GraphQLBigInteger
        This represents the "BigInteger" type which is a representation of java.math.BigInteger
      • GraphQLChar

        public static final graphql.schema.GraphQLScalarType GraphQLChar
        This represents the "Char" type which is a representation of java.lang.Character
    • Constructor Detail

      • ExtendedScalars

        public ExtendedScalars()
    • Method Detail

      • newRegexScalar

        public static RegexScalar.Builder newRegexScalar​(java.lang.String name)
        A builder of a scalar that uses one or more regular expression Patterns to control the acceptable values for that scalar.

        The scalar converts any passed in objects to Strings first and them matches it against the provided scalars to ensure its an acceptable value.

        Parameters:
        name - the name of the scalar
        Returns:
        a builder of a regex scalar
      • newAliasedScalar

        public static AliasedScalar.Builder newAliasedScalar​(java.lang.String name)
        This allows an existing scalar to be wrapped and aliased with a new name.

        For example you may take a `String` scalar and alias it as `SocialMediaLink` if that helps introduce more semantic meaning to your type system.

         
        
         type Customer {
              name : String
              socialMediaLink : SocialMediaLink
         }
         
         

        A future version of the graphql specification may add this capability but in the meantime you can use this facility.

        Parameters:
        name - the name of the aliased scalar
        Returns:
        a builder of a aliased scalar