Package com.piketec.tpt.api.util
Class IterableRemoteIndexedList<KEY,T>
- java.lang.Object
-
- com.piketec.tpt.api.util.IterableRemoteCollection<T>
-
- com.piketec.tpt.api.util.IterableRemoteList<T>
-
- com.piketec.tpt.api.util.IterableRemoteIndexedList<KEY,T>
-
- Type Parameters:
KEY
- the type of the keys of this indexed listT
- the type of elements in this indexed list
- All Implemented Interfaces:
RemoteCollection<T>
,RemoteIndexedList<KEY,T>
,RemoteList<T>
,TptRemote
,RemoteIterable<T>
,java.io.Serializable
,java.lang.Iterable<T>
,java.rmi.Remote
public class IterableRemoteIndexedList<KEY,T> extends IterableRemoteList<T> implements RemoteIndexedList<KEY,T>
A wrapper obejct to provide iterable functionallity for aRemoteIndexedList
. Since all methods of aRemote
interface must throw aRemoteException
we cannot implementIterable
directly.
This wrapper has the same interface as aRemoteCollection
and additionally implements theIterable
interface. Since the methods of the latter do not throwRemoteException
this Object cannot be exported as aRemoteObject
.- Author:
- Copyright (c) 2014-2024 Piketec GmbH - MIT License (MIT) - All rights reserved
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IterableRemoteIndexedList(RemoteIndexedList<KEY,T> delegate)
An iterable view on aRemoteIndexedList
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IterableRemoteIndexedList<KEY,T>
asIterable()
Provides anIterable
view of thisRemoteIterable
.boolean
containsKey(KEY key)
Returnstrue
if this list contains an object with the given key.T
get(KEY key)
Returns the value object for the given key ornull
if no such value exists.KEY
getKey(T obj)
Returns the key that belongs to the given value object.RemoteCollection<KEY>
keySet()
Returns a set of the keys contained in this list.T
removeByKey(KEY key)
Removes the object with the given key from the list.-
Methods inherited from class com.piketec.tpt.api.util.IterableRemoteList
delete, get, indexOf, move
-
Methods inherited from class com.piketec.tpt.api.util.IterableRemoteCollection
clear, contains, containsAll, delete, deleteAll, getItems, isEmpty, iterator, remoteIterator, retainAll, size
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.piketec.tpt.api.RemoteCollection
clear, contains, containsAll, delete, deleteAll, getItems, isEmpty, retainAll, size
-
Methods inherited from interface com.piketec.tpt.api.util.RemoteIterable
remoteIterator
-
Methods inherited from interface com.piketec.tpt.api.RemoteList
delete, get, indexOf, move
-
-
-
-
Constructor Detail
-
IterableRemoteIndexedList
public IterableRemoteIndexedList(RemoteIndexedList<KEY,T> delegate)
An iterable view on aRemoteIndexedList
. Most likely not needed by API users.- Parameters:
delegate
- The remote indexed list for which an iterable view is needed.- See Also:
RemoteIndexedList.asIterable()
-
-
Method Detail
-
get
public T get(KEY key) throws ApiException, java.rmi.RemoteException
Description copied from interface:RemoteIndexedList
Returns the value object for the given key ornull
if no such value exists.- Specified by:
get
in interfaceRemoteIndexedList<KEY,T>
- Parameters:
key
- the key whose associated value is to be returned- Returns:
- the value object for the given key
- Throws:
java.rmi.RemoteException
- remote communication problemApiException
-
getKey
public KEY getKey(T obj) throws java.rmi.RemoteException
Description copied from interface:RemoteIndexedList
Returns the key that belongs to the given value object.- Specified by:
getKey
in interfaceRemoteIndexedList<KEY,T>
- Parameters:
obj
- the value object whose key is to be returned- Returns:
- the key that belongs to the given value object
- Throws:
java.rmi.RemoteException
- remote communication problem
-
removeByKey
public T removeByKey(KEY key) throws java.rmi.RemoteException
Description copied from interface:RemoteIndexedList
Removes the object with the given key from the list.- Specified by:
removeByKey
in interfaceRemoteIndexedList<KEY,T>
- Parameters:
key
- the key whose associated value is to be removed- Returns:
- the removed object with the specified key
- Throws:
java.rmi.RemoteException
- remote communication problem
-
containsKey
public boolean containsKey(KEY key) throws java.rmi.RemoteException
Description copied from interface:RemoteIndexedList
Returnstrue
if this list contains an object with the given key.- Specified by:
containsKey
in interfaceRemoteIndexedList<KEY,T>
- Parameters:
key
- the key whose presence in this list is to be tested- Returns:
true
if this list contains an object for the specified key- Throws:
java.rmi.RemoteException
- remote communication problem
-
keySet
public RemoteCollection<KEY> keySet() throws java.rmi.RemoteException
Description copied from interface:RemoteIndexedList
Returns a set of the keys contained in this list.- Specified by:
keySet
in interfaceRemoteIndexedList<KEY,T>
- Returns:
- set of keys
- Throws:
java.rmi.RemoteException
- remote communication problem
-
asIterable
public IterableRemoteIndexedList<KEY,T> asIterable() throws java.rmi.RemoteException
Description copied from interface:RemoteIterable
Provides anIterable
view of thisRemoteIterable
. This normally usesRemoteIterable.remoteIterator()
and wraps the return value into a realIterator
that throwsRuntimeExceptions
instead ofRemoteExceptions
so that this view can be used in for-each loops.- Specified by:
asIterable
in interfaceRemoteCollection<KEY>
- Specified by:
asIterable
in interfaceRemoteIndexedList<KEY,T>
- Specified by:
asIterable
in interfaceRemoteIterable<KEY>
- Specified by:
asIterable
in interfaceRemoteList<KEY>
- Overrides:
asIterable
in classIterableRemoteList<T>
- Returns:
- an iterable view of this
RemoteIterable
- Throws:
java.rmi.RemoteException
- remote communication problem- See Also:
ApiIterator
-
-