com.vaadin.flow.shared.

Interface Registration

    • Method Summary

      All Methods
      Modifier and Type Method and Description
      static <T> Registration addAndRemove(Collection<T> collection, T item)

      Creates a registration by adding an item to a collection immediately and removing the item from the collection when the registration is removed.

      static Registration combine(Registration... registrations)

      Creates a registration that will remove multiple registrations.

      static Registration once(Command command)

      Creates a registration that will run a command only once.

      void remove()

      Removes the associated listener from the event source.

    • Method Detail

      • remove

        void remove()

        Removes the associated listener from the event source.

        The remove method called after removal does nothing.

        See Also:

        once(Command)

      • once

        static Registration once(Command command)

        Creates a registration that will run a command only once. This makes it safe for the registration to be removed multiple times even in cases when the command should be run only once.

        Parameters:

        command - the command to run the first time the registration is removed, not null

        Returns:

        a registration that will invoke the command once, not null

        Since:

      • combine

        static Registration combine(Registration... registrations)

        Creates a registration that will remove multiple registrations.

        Parameters:

        registrations - the registrations to remove, not null

        Returns:

        a registration that removes all provided registrations, not null

        Since:

      • addAndRemove

        static <T> Registration addAndRemove(Collection<T> collection,
                                             T item)

        Creates a registration by adding an item to a collection immediately and removing the item from the collection when the registration is removed.

        Care should be used when using this pattern to iterate over a copy of the collection to avoid ConcurrentModificationException if a listener or other callback may trigger adding or removing registrations.

        Parameters:

        collection - the collection to which the item should be added and removed, not null

        item - the item to add and remove

        Returns:

        a registration that will remove the item from the collection, not null

        Since: