Class HalResourceFilters


  • @ProviderType
    public final class HalResourceFilters
    extends Object
    Default filtering predicates for HAL resources.
    • Method Detail

      • all

        public static HalResourcePredicate all​(HalResourcePredicate... predicates)
        Executes all predicates and combines the result by logical and. If there are negative predicate results, remaining predicates will not get executed.
        Parameters:
        predicates - Predicates to check
        Returns:
        True if all predicates return true
      • hasPathNonNull

        public static HalResourcePredicate hasPathNonNull​(String jsonPath)
        Parameters:
        jsonPath - JSON path to check
        Returns:
        True if model has field(s) for given JSON path and all values are not null
      • hasNonNull

        public static HalResourcePredicate hasNonNull​(String fieldName)
        Parameters:
        fieldName - JSON field name
        Returns:
        True if field exists and is not null
      • hasEmbedded

        public static HalResourcePredicate hasEmbedded​(String relation)
        Parameters:
        relation - Relation name of the embedded resource
        Returns:
        True if HAL resource has one or more embedded resources for the given relation name
      • object

        public static <S> HalResourcePredicate object​(Class<S> clazz,
                                                      rx.functions.Func1<S,​Boolean> function)
        Converts the state of the HAL resource to an object of the given type and applies the provided function.
        Type Parameters:
        S - Type of the HAL resource state
        Parameters:
        clazz - Class type of the HAL resource state
        function - Function to apply on the object
        Returns:
        Return value of the executed function