Class FilterResourceResolver


  • public class FilterResourceResolver
    extends Object
    author Pascal Knueppel
    created at: 20.10.2019 - 20:17

    This class is used to use a FilterNode tree on a resource list to filter all resources that match the given filter expression
    • Constructor Detail

      • FilterResourceResolver

        public FilterResourceResolver()
    • Method Detail

      • filterResources

        public static <T extends ResourceNodeList<T> filterResources​(List<T> resources,
                                                                       FilterNode filterNode)
        filters the given resources based on the filternode
        Type Parameters:
        T - a ResourceNode type
        Parameters:
        resources - the resources that must be filtered
        filterNode - the filter node that holds the information how the resources should be filtered
        Returns:
        the filtered resources
      • checkValueEquality

        protected static boolean checkValueEquality​(com.fasterxml.jackson.databind.JsonNode attributeNode,
                                                    AttributeExpressionLeaf attributeExpressionLeaf)
        checks if the given simple attribute node does match the given filter expression
        Parameters:
        attributeNode - a simple attribute node with primitive values. This might be a json array with primitives or a json primitive
        attributeExpressionLeaf - the expression leaf that describes the node
        Returns:
        true if the attribute matches the expression, false else