Class Options<T>


  • public class Options<T>
    extends Object
    Configuration options to be looked up in the Configuration. Unless noted all options are optional and return a default value if the value was not found in the configuration.
    Author:
    James R. Perkins
    • Field Detail

      • ENABLE_DEFAULT_EXCEPTION_MAPPER

        public static final Options<Boolean> ENABLE_DEFAULT_EXCEPTION_MAPPER
        An option for enabling or disabling the default exception mapper. By default the default exception mapper is enabled.
      • ENTITY_MEMORY_THRESHOLD

        public static final Options<Threshold> ENTITY_MEMORY_THRESHOLD
        An option for the threshold of the EntityOutputStream. The threshold is used to determine when to offload an entity to a file out of memory.

        The default is 5 MB.

      • ENTITY_FILE_THRESHOLD

        public static final Options<Threshold> ENTITY_FILE_THRESHOLD
        An option for the threshold of the EntityOutputStream to write to a file. A value of -1 indicates no threshold limit.

        The default is 50 MB.

      • SSE_CLOSED_RESPONSE_CODE

        public static final Options<Integer> SSE_CLOSED_RESPONSE_CODE
        An option which allows which HTTP status code should be sent when the SseEventSink.close() is invoked. In some implementations 200 (OK) is the default. However, RESTEasy prefers 204 (No Content) as no content has been sent the response.

        The default is 204 - No Content

    • Method Detail

      • getValue

        public T getValue()
        Resolves the value from the configuration
        Returns:
        the value or the default value which may be null
      • name

        public String name()
        The key for the property.
        Returns:
        the key for the property
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getProperty

        protected static <T> T getProperty​(String name,
                                           Class<T> returnType,
                                           Supplier<T> dft)
        Checks the Configuration for the property returning the value or the given default.
        Parameters:
        name - the name of the property
        returnType - the type of the property
        dft - the default value if the property was not found
        Returns:
        the value found in the configuration or the default value