Class RequestScope


  • public final class RequestScope
    extends Object
    Local thread holder for the current request RequestScope.Scope.

    RequestScope.Scope consists by the ApiGuideline.ApiGuidelineVersion provided by the RestController and a list of 'fields' provided by the current HttpServletRequest.

    Author:
    Thiago A. de Souza Weber
    See Also:
    RequestScope.Scope, ThreadLocal
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Collection<String> getExpandables()
      Return the list of 'expandables' specified in current HttpServletRequest to be serialized.
      static Collection<String> getFields()
      Return the list of 'fields' specified in current HttpServletRequest to be serialized.
      static com.totvs.tjf.api.context.stereotype.ApiGuideline.ApiGuidelineVersion getGuidelineVersion()
      Return the ApiGuideline.ApiGuidelineVersion specified in RestController by the ApiGuideline annotation for the current HttpServletRequest.
      static boolean hasEmptyExpandables()
      Checks if this thread process has any 'expand' specified in current HttpServletRequest to be serialized.
      static boolean hasEmptyFields()
      Checks if this thread process has any 'field' specified in current HttpServletRequest to be serialized.
      static boolean isEmpty()
      Checks if this thread process has a RequestScope.Scope for the current HttpServletRequest.
      static boolean isError()
      Returns if the request contains a error.
      static void setError()
      Sets if the request contains a error.
      static boolean supportsExpand()
      Return the expandable support.
      static boolean supportsFields()
      Return the fields support.
    • Method Detail

      • isEmpty

        public static boolean isEmpty()
        Checks if this thread process has a RequestScope.Scope for the current HttpServletRequest.
        Returns:
        true if this thread process has a RequestScope.Scope, otherwise, false
      • hasEmptyFields

        public static boolean hasEmptyFields()
        Checks if this thread process has any 'field' specified in current HttpServletRequest to be serialized.
        Returns:
        true if 'fields' list is empty in this thread process, otherwise, false
      • hasEmptyExpandables

        public static boolean hasEmptyExpandables()
        Checks if this thread process has any 'expand' specified in current HttpServletRequest to be serialized.
        Returns:
        true if 'expand' list is empty in this thread process, otherwise, false
      • getGuidelineVersion

        public static com.totvs.tjf.api.context.stereotype.ApiGuideline.ApiGuidelineVersion getGuidelineVersion()
        Return the ApiGuideline.ApiGuidelineVersion specified in RestController by the ApiGuideline annotation for the current HttpServletRequest.
        Returns:
        ApiGuideline.ApiGuidelineVersion or null if RequestScope.Scope is empty
      • getFields

        public static Collection<String> getFields()
        Return the list of 'fields' specified in current HttpServletRequest to be serialized.
        Returns:
        list of 'fields' or null if RequestScope.Scope is empty
      • getExpandables

        public static Collection<String> getExpandables()
        Return the list of 'expandables' specified in current HttpServletRequest to be serialized.
        Returns:
        list of 'expandables' or null if RequestScope.Scope is empty
      • supportsFields

        public static boolean supportsFields()
        Return the fields support.
        Returns:
        true if the current REST endpoint supports fields.
      • supportsExpand

        public static boolean supportsExpand()
        Return the expandable support.
        Returns:
        true if the current REST endpoint supports expandables.
      • isError

        public static boolean isError()
        Returns if the request contains a error.
        Returns:
        true if the request contains a error.
      • setError

        public static void setError()
        Sets if the request contains a error.