Class SynchronizableRepeater


  • public final class SynchronizableRepeater
    extends Object
    Wrapper for a synchronizable repeater.
    Contains the repeater values and a mapping between stored entry positions and new ones.
    • Method Detail

      • replaceAll

        public static SynchronizableRepeater replaceAll​(List<Map<String,​Object>> entries,
                                                        Map<Integer,​Integer> positionsMapping)
        Replace all values in a repeater, optionally moving or removing entries. Entries not present in the mapping will be removed.
        Parameters:
        entries - the new repeater values.
        positionsMapping - a mapping from stored positions to new ones. No mapping for an existing entry means removal. A null mapping means the identity mapping.
        Returns:
        a SynchronizableRepeater in replace mode.
      • getPositionsMapping

        public Map<Integer,​IntegergetPositionsMapping()
        Returns the mapping from stored positions to new ones.
        Returns:
        the mapping from stored positions to new ones.
      • getReplacePositions

        public List<IntegergetReplacePositions()
        Returns the positions of replacing entries.
        Returns:
        the positions of replacing entries.
      • getRemovedEntries

        public Set<IntegergetRemovedEntries()
        Returns the entries to be removed.
        Only relevant for append mode.
        For replace mode, removed entries are carried trough the positions mapping.
        Returns:
        the new repeater values.
      • getPreviousPosition

        public Optional<IntegergetPreviousPosition​(int newPosition)
        Retrieves the previous position of the given one from the repeater mapping
        Parameters:
        newPosition - the new entry position
        Returns:
        the previous entry position