Record Class GraphQlOptions

java.lang.Object
java.lang.Record
com.jsgalactic.axiom.graphql.GraphQlOptions
Record Components:
maxBodyBytes - maximum request body in bytes, 1 to 1048576
maxDepth - maximum query depth enforced by graphql-java, 1 to 100
maxComplexity - maximum query complexity enforced by graphql-java, 1 to 100000
introspection - whether __schema and __type may be queried
getQueries - whether queries (never mutations) may be sent as GET with query parameters

public record GraphQlOptions(int maxBodyBytes, int maxDepth, int maxComplexity, boolean introspection, boolean getQueries) extends Record
Bounds and switches of a GraphQl handler, supplied as plain data.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final GraphQlOptions
    Bounded defaults: 64 KiB body, depth 10, complexity 100, no introspection, POST only.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GraphQlOptions(int maxBodyBytes, int maxDepth, int maxComplexity, boolean introspection, boolean getQueries)
    Validates the bounds so a handler can never be built with unbounded work.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Returns the value of the getQueries record component.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the introspection record component.
    int
    Returns the value of the maxBodyBytes record component.
    int
    Returns the value of the maxComplexity record component.
    int
    Returns the value of the maxDepth record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT

      public static final GraphQlOptions DEFAULT
      Bounded defaults: 64 KiB body, depth 10, complexity 100, no introspection, POST only.
  • Constructor Details

    • GraphQlOptions

      public GraphQlOptions(int maxBodyBytes, int maxDepth, int maxComplexity, boolean introspection, boolean getQueries)
      Validates the bounds so a handler can never be built with unbounded work.
      Throws:
      IllegalArgumentException - if a bound is outside its range
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • maxBodyBytes

      public int maxBodyBytes()
      Returns the value of the maxBodyBytes record component.
      Returns:
      the value of the maxBodyBytes record component
    • maxDepth

      public int maxDepth()
      Returns the value of the maxDepth record component.
      Returns:
      the value of the maxDepth record component
    • maxComplexity

      public int maxComplexity()
      Returns the value of the maxComplexity record component.
      Returns:
      the value of the maxComplexity record component
    • introspection

      public boolean introspection()
      Returns the value of the introspection record component.
      Returns:
      the value of the introspection record component
    • getQueries

      public boolean getQueries()
      Returns the value of the getQueries record component.
      Returns:
      the value of the getQueries record component