Class IterableRemoteList<T>

  • Type Parameters:
    T - the type of elements in this list
    All Implemented Interfaces:
    RemoteCollection<T>, RemoteList<T>, TptRemote, RemoteIterable<T>, java.io.Serializable, java.lang.Iterable<T>, java.rmi.Remote
    Direct Known Subclasses:
    IterableRemoteIndexedList

    public class IterableRemoteList<T>
    extends IterableRemoteCollection<T>
    implements RemoteList<T>
    A wrapper obejct to provide iterable functionallity for a RemoteList. Since all methods of a Remote interface must throw a RemoteException we cannot implement Iterable directly.
    This wrapper has the same interface as a RemoteCollection and additionally implements the Iterable interface. Since the methods of the latter do not throw RemoteException this Object cannot be exported as a RemoteObject.
    Author:
    Copyright (c) 2014-2024 Piketec GmbH - MIT License (MIT) - All rights reserved
    See Also:
    Serialized Form
    • Constructor Detail

      • IterableRemoteList

        public IterableRemoteList​(RemoteList<T> delegate)
        An iterable view on a RemoteList. Most likely not needed by API users.
        Parameters:
        delegate - The remote list for which an iterable view is needed.
        See Also:
        RemoteList.asIterable()
    • Method Detail

      • get

        public T get​(int index)
              throws ApiException,
                     java.lang.IndexOutOfBoundsException,
                     java.rmi.RemoteException
        Description copied from interface: RemoteList
        Returns the element at position index.
        Specified by:
        get in interface RemoteList<T>
        Parameters:
        index - The position of the element in the list.
        Returns:
        The element that is at this position.
        Throws:
        java.lang.IndexOutOfBoundsException - If the index < 0 or index >= getItems().size()
        java.rmi.RemoteException - remote communication problem
        ApiException
      • delete

        public void delete​(int index)
                    throws ApiException,
                           java.lang.IndexOutOfBoundsException,
                           java.rmi.RemoteException
        Description copied from interface: RemoteList
        Removes the element at position index from the list.
        Specified by:
        delete in interface RemoteList<T>
        Parameters:
        index - The position of the item that should be deleted.
        Throws:
        java.lang.IndexOutOfBoundsException - If the index < 0 or index >= getItems().size()
        java.rmi.RemoteException - remote communication problem
        ApiException
      • move

        public T move​(int from,
                      int to)
               throws ApiException,
                      java.lang.IndexOutOfBoundsException,
                      java.rmi.RemoteException
        Description copied from interface: RemoteList
        Moves an element from the position from to to. All elements in this interval will be shifted accordingly such that no gaps exist afterwards and no items will be overwritten.
        Specified by:
        move in interface RemoteList<T>
        Parameters:
        from - The old position of the element.
        to - The new position for the element given by from
        Returns:
        Returns a reference to the moved item.
        Throws:
        java.lang.IndexOutOfBoundsException - If to < 0 or from < 0 or to >= getItems().size() or from >= getItems().size()
        java.rmi.RemoteException - remote communication problem
        ApiException
      • indexOf

        public int indexOf​(T element)
                    throws java.rmi.RemoteException,
                           ApiException
        Description copied from interface: RemoteList
        Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.More formally, returns the lowest index i such that Objects.equals(o, get(i)), or -1 if there is no such index.
        Specified by:
        indexOf in interface RemoteList<T>
        Parameters:
        element - element to search for
        Returns:
        the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
        Throws:
        java.rmi.RemoteException - remote communication problem
        ApiException