Package ratpack.parse

Class Parse<T,​O>

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<O> getOpts()
      The type of object that provides options/configuration for the parsing.
      com.google.common.reflect.TypeToken<T> getType()
      The type of object to construct from the request body.
      static <T> Parse<T,​?> of​(com.google.common.reflect.TypeToken<T> type)
      Creates a parse object, with no options.
      static <T,​O>
      Parse<T,​O>
      of​(com.google.common.reflect.TypeToken<T> type, O opts)
      Creates a parse object.
      static <T> Parse<T,​?> of​(java.lang.Class<T> type)
      Creates a parse object, with no options.
      static <T,​O>
      Parse<T,​O>
      of​(java.lang.Class<T> type, O opts)
      Creates a parse object.
      • Methods inherited from class java.lang.Object

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

      • getType

        public com.google.common.reflect.TypeToken<T> getType()
        The type of object to construct from the request body.
        Returns:
        the type of object to construct from the request body
      • getOpts

        public java.util.Optional<O> getOpts()
        The type of object that provides options/configuration for the parsing.

        For any parse request, no options may be specified. Parser implementations should throw an exception if they require an options object when none is supplied.

        Returns:
        the type of object that provides options/configuration for the parsing
      • of

        public static <T,​O> Parse<T,​O> of​(com.google.common.reflect.TypeToken<T> type,
                                                      O opts)
        Creates a parse object.
        Type Parameters:
        T - the type of object to construct from the request body
        O - the type of object that provides options/configuration for the parsing
        Parameters:
        type - the type of object to construct from the request body
        opts - the options object
        Returns:
        a parse instance from the given arguments
      • of

        public static <T> Parse<T,​?> of​(com.google.common.reflect.TypeToken<T> type)
        Creates a parse object, with no options.
        Type Parameters:
        T - the type of object to construct from the request body
        Parameters:
        type - the type of object to construct from the request body
        Returns:
        a parse instance to the given type
      • of

        public static <T,​O> Parse<T,​O> of​(java.lang.Class<T> type,
                                                      O opts)
        Creates a parse object.
        Type Parameters:
        T - the type of object to construct from the request body
        O - the type of object that provides options/configuration for the parsing
        Parameters:
        type - the type of object to construct from the request body
        opts - the options object
        Returns:
        a parse instance from the given arguments
      • of

        public static <T> Parse<T,​?> of​(java.lang.Class<T> type)
        Creates a parse object, with no options.
        Type Parameters:
        T - the type of object to construct from the request body
        Parameters:
        type - the type of object to construct from the request body
        Returns:
        a parse instance to the given type