Class FileValueDescriptorIntersector


  • public final class FileValueDescriptorIntersector
    extends Object
    • Method Detail

      • intersectContentTypes

        public static Set<String> intersectContentTypes​(Set<String> lhs,
                                                        Set<String> rhs)
        Intersects two sets of mime types. The intersection of two sets of mime types is a new set of mime types that matches both input sets. When the input sets are incompatible, the intersection is an empty set.

        Examples:

             intersectContentTypes(Set.of("text/plain"), Set.of("text/plain")) = Set.of("text/plain")
             intersectContentTypes(Set.of("text/plain"), Set.of("application/json")) = Set.of()
             intersectContentTypes(Set.of("text/plain"), Set.of("text/*")) = Set.of("text/plain")
             intersectContentTypes(Set.of("text/*"), Set.of("application/*")) = Set.of()
             intersectContentTypes(Set.of("text/*"), Set.of("text/*")) = Set.of("text/*")
             intersectContentTypes(Set.of("text/plain", "image/*"), Set.of("text/plain", "image/jpeg"))
               = Set.of("text/plain", "image/png)
             intersectContentTypes(Set.of("*/*"), Set.of("text/*")) = Set.of("text/*")
             intersectContentTypes(Set.of("*/*"), Set.of("text/plain")) = Set.of("text/plain")
         
        Parameters:
        lhs - The left hand side set of mime types.
        rhs - The right hand side set of mime types.
        Returns:
        The intersected set of mime types.
      • intersectFileListDescriptors

        public static IFileListDescriptor intersectFileListDescriptors​(IFileListDescriptor lhs,
                                                                       IFileListDescriptor rhs)
        Intersects two file list descriptors. The intersection of two file list descriptors is a new file list descriptor that allows only files that is allowed by both input descriptors, but no other files. When the input descriptors are incompatible, the intersection is an empty file list descriptor.
        Parameters:
        lhs - The left hand side file list descriptor.
        rhs - The right hand side file list descriptor.
        Returns:
        The intersected file list descriptor.
      • intersectFileValueDescriptors

        public static IFileValueDescriptor intersectFileValueDescriptors​(IFileValueDescriptor lhs,
                                                                         IFileValueDescriptor rhs)
        Intersects two file value descriptors. The intersection of two file value descriptors is a new file value descriptor that allows only files that is allowed by both input descriptors, but no other files. When the input descriptors are incompatible, the intersection is an empty file value descriptor.

        If the left hand side is null, the right hand side is returned. If the right hand side is null, the left hand side is returned. If both are null, an empty file value descriptor is returned. Effectively, this means that null is treated as a wildcard that matches any file.

        Parameters:
        lhs - The left hand side file value descriptor.
        rhs - The right hand side file value descriptor.
        Returns:
        The intersected file value descriptor.
      • intersectMimeTypes

        public static String intersectMimeTypes​(String lhs,
                                                String rhs)
        Intersects two mime types. The intersection of two mime types is a new mime type that matches both input mime types. When the input mime types are incompatible, the intersection is null.
        Parameters:
        lhs - The left hand side mime type.
        rhs - The right hand side mime type.
        Returns:
        The intersected mime type or null if the mime types are incompatible.