Package oracle.pgx.api
Class PgxCollection<E,ID>
- java.lang.Object
-
- oracle.pgx.api.internal.ApiObject
-
- oracle.pgx.api.Destroyable
-
- oracle.pgx.api.PgxManagedObject
-
- oracle.pgx.api.PgxCollection<E,ID>
-
- Type Parameters:
E- the element typeID- the ID type of the element type
- All Implemented Interfaces:
java.lang.AutoCloseable,java.lang.Iterable<E>,oracle.pgx.common.IdentifiableCollection
- Direct Known Subclasses:
GraphEntityCollection,ScalarCollection
public abstract class PgxCollection<E,ID> extends PgxManagedObject implements java.lang.Iterable<E>, oracle.pgx.common.IdentifiableCollection
Superclass for Pgx collections.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(E entity)Adds one element to this collection.abstract voidaddAll(PgxEntity[] elements)Adds elements of aPgxEntityarray to this collection.PgxFuture<java.lang.Void>addAllAsync(E[] elements)Add elements to an existing collection.voidaddAllElements(java.util.Collection<E> source)Blocking version ofaddAllElementsAsync(Collection).abstract PgxFuture<java.lang.Void>addAllElementsAsync(java.util.Collection<E> source)Adds elements to an existing collection.voidclear()Blocking version ofclearAsync().PgxFuture<java.lang.Void>clearAsync()Clear an existing collectionPgxCollection<E,ID>clone()PgxCollection<E,ID>clone(java.lang.String newName)Blocking version ofclone(String).PgxFuture<PgxCollection<E,ID>>cloneAsync()PgxFuture<PgxCollection<E,ID>>cloneAsync(java.lang.String newName)Clone an existing collection.booleancontains(E element)Blocking version of#containsAsync(E).abstract PgxFuture<java.lang.Boolean>containsAsync(E element)Returnstrueif this collection contains the specified element.PgxFuture<java.lang.Void>destroyAsync()Requests destruction of this object.CollectionTypegetCollectionType()Gets the collection type.PropertyTypegetContentType()Gets this collection's content type.PgxGraphgetGraph()Gets the graph.oracle.pgx.common.PgxIdgetId()Returns an internal identifier for this collection.abstract IdTypegetIdType()Gets the ID type of the element type.java.lang.StringgetName()booleanisMutable()Blocking version ofisMutableAsync().PgxFuture<java.lang.Boolean>isMutableAsync()Checks whether an existing collection is mutablejava.util.Iterator<E>iterator()Blocking version ofiteratorAsync().PgxFuture<java.util.Iterator<E>>iteratorAsync()Gets an Iterator over the collection.voidremove(E entity)Removes one element from this collection.voidremoveAllElements(java.util.Collection<E> source)Blocking version ofremoveAllElementsAsync(Collection).abstract PgxFuture<java.lang.Void>removeAllElementsAsync(java.util.Collection<E> source)Removes elements from an existing collection.intsize()Blocking version ofsizeAsync().PgxFuture<java.lang.Integer>sizeAsync()Gets the number of elements in this collectionjava.util.stream.Stream<E>stream()Creates a new sequential or parallelStreamfromSpliterator.PgxCollection<E,ID>toMutable()Blocking version oftoMutableAsync().PgxCollection<E,ID>toMutable(java.lang.String newName)Blocking version oftoMutableAsync(String).PgxFuture<PgxCollection<E,ID>>toMutableAsync()Create a mutable copy of an existing collectionPgxFuture<PgxCollection<E,ID>>toMutableAsync(java.lang.String newName)Create a mutable copy of an existing collectionjava.lang.StringtoString()(non-Javadoc)-
Methods inherited from class oracle.pgx.api.PgxManagedObject
equals, hashCode
-
Methods inherited from class oracle.pgx.api.Destroyable
close, destroy
-
-
-
-
Method Detail
-
getId
public oracle.pgx.common.PgxId getId()
Returns an internal identifier for this collection. Only meant for internal usage.- Specified by:
getIdin interfaceoracle.pgx.common.IdentifiableCollection- Returns:
- the internal identifier of this collection
- Since:
- 20.0
-
getName
public java.lang.String getName()
- Specified by:
getNamein classPgxManagedObject- Returns:
- the name identifying this managed object
-
getGraph
public PgxGraph getGraph()
Gets the graph.- Returns:
- the graph this PgxCollection is bound to
-
destroyAsync
public PgxFuture<java.lang.Void> destroyAsync()
Description copied from class:DestroyableRequests destruction of this object. After this method returns, the behavior of any method of this class becomes undefined.- Specified by:
destroyAsyncin classDestroyable- Returns:
- a future which will be completed once the destruction request finishes.
-
getCollectionType
public CollectionType getCollectionType()
Gets the collection type.- Returns:
- the collection type
-
getContentType
public PropertyType getContentType()
Gets this collection's content type.- Returns:
- this collection's content type
- Since:
- 2.7.0
-
stream
public java.util.stream.Stream<E> stream()
Creates a new sequential or parallelStreamfromSpliterator.- Returns:
- a new sequential or parallel
Stream
-
addAllAsync
public PgxFuture<java.lang.Void> addAllAsync(E[] elements)
Add elements to an existing collection.- Parameters:
elements- elements to add
-
addAllElementsAsync
public abstract PgxFuture<java.lang.Void> addAllElementsAsync(java.util.Collection<E> source)
Adds elements to an existing collection.- Parameters:
source- elements to add
-
removeAllElementsAsync
public abstract PgxFuture<java.lang.Void> removeAllElementsAsync(java.util.Collection<E> source)
Removes elements from an existing collection.- Parameters:
source- elements to remove
-
clearAsync
public PgxFuture<java.lang.Void> clearAsync()
Clear an existing collection
-
cloneAsync
public PgxFuture<PgxCollection<E,ID>> cloneAsync()
- Returns:
- the cloned collection
-
cloneAsync
public PgxFuture<PgxCollection<E,ID>> cloneAsync(java.lang.String newName)
Clone an existing collection.- Parameters:
newName- name of the new collection- Returns:
- the cloned collection
-
toMutableAsync
public PgxFuture<PgxCollection<E,ID>> toMutableAsync()
Create a mutable copy of an existing collection
Convenience method around
toMutableAsync(String)passing name asnull- Returns:
- the mutable copy
-
toMutableAsync
public PgxFuture<PgxCollection<E,ID>> toMutableAsync(java.lang.String newName)
Create a mutable copy of an existing collection- Parameters:
newName- name of the new collection- Returns:
- the mutable copy
-
isMutableAsync
public PgxFuture<java.lang.Boolean> isMutableAsync()
Checks whether an existing collection is mutable- Returns:
trueif the collection is mutable,falseif it is immutable
-
toString
public java.lang.String toString()
(non-Javadoc)- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
getIdType
public abstract IdType getIdType()
Gets the ID type of the element type.- Returns:
- the ID type of the element type.
-
sizeAsync
public PgxFuture<java.lang.Integer> sizeAsync()
Gets the number of elements in this collection- Returns:
- number of elements in this collection
-
iteratorAsync
public PgxFuture<java.util.Iterator<E>> iteratorAsync()
Gets an Iterator over the collection.- Returns:
- an Iterator over the collection
-
add
public void add(E entity)
Adds one element to this collection.- Parameters:
entity- the entity
-
remove
public void remove(E entity)
Removes one element from this collection.- Parameters:
entity- the entity
-
containsAsync
public abstract PgxFuture<java.lang.Boolean> containsAsync(E element)
Returnstrueif this collection contains the specified element.- Parameters:
element- element whose presence in this collection is to be tested- Returns:
trueif this collection contains the specified element
-
size
public int size()
Blocking version ofsizeAsync(). CallssizeAsync()and waits for the returnedPgxFutureto complete.
-
iterator
public java.util.Iterator<E> iterator()
Blocking version ofiteratorAsync(). CallsiteratorAsync()and waits for the returnedPgxFutureto complete.- Specified by:
iteratorin interfacejava.lang.Iterable<E>
-
addAll
public abstract void addAll(PgxEntity[] elements)
Adds elements of aPgxEntityarray to this collection.- Parameters:
elements- thePgxEntityarray containing the elements to add
-
addAllElements
public void addAllElements(java.util.Collection<E> source)
Blocking version ofaddAllElementsAsync(Collection). CallsaddAllElementsAsync(Collection)and waits for the returnedPgxFutureto complete.
-
removeAllElements
public void removeAllElements(java.util.Collection<E> source)
Blocking version ofremoveAllElementsAsync(Collection). CallsremoveAllElementsAsync(Collection)and waits for the returnedPgxFutureto complete.
-
clear
public void clear()
Blocking version ofclearAsync(). CallsclearAsync()and waits for the returnedPgxFutureto complete.
-
toMutable
public PgxCollection<E,ID> toMutable() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Blocking version oftoMutableAsync(). CallstoMutableAsync()and waits for the returnedPgxFutureto complete.- Throws:
java.lang.InterruptedException- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException- if any exception occurred during asynchronous execution. The actual exception will be nested.
-
toMutable
public PgxCollection<E,ID> toMutable(java.lang.String newName) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Blocking version oftoMutableAsync(String). CallstoMutableAsync(String)and waits for the returnedPgxFutureto complete.- Throws:
java.lang.InterruptedException- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException- if any exception occurred during asynchronous execution. The actual exception will be nested.
-
isMutable
public boolean isMutable() throws java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionBlocking version ofisMutableAsync(). CallsisMutableAsync()and waits for the returnedPgxFutureto complete.- Throws:
java.lang.InterruptedException- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException- if any exception occurred during asynchronous execution. The actual exception will be nested.
-
clone
public PgxCollection<E,ID> clone()
-
clone
public PgxCollection<E,ID> clone(java.lang.String newName) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Blocking version ofclone(String). Callsclone(String)and waits for the returnedPgxFutureto complete.- Throws:
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-
-