@NotThreadSafe public final class StoreValues extends AbstractCollection<PointValue> implements Externalizable
A store values instance is created by a store server to hold the point values generated by the processing of a store query.
When a query generates too many values for a single response, the store
values contains a Mark
which can be used to generate a new query to get the next values.
Instead of point values, a store values instance may contain an exception that will explain what went wrong with the query.
Constructor and Description |
---|
StoreValues()
Constructs an instance.
|
StoreValues(Exception exception)
Constructs an instance.
|
StoreValues(StoreValuesQuery query)
Constructs a store values.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(PointValue pointValue)
Adds a point value.
|
void |
clear() |
StoreValuesQuery |
createQuery()
Creates a store query to get further values.
|
boolean |
equals(Object object) |
long |
getCount()
Gets the count of values.
|
Optional<Exception> |
getException()
Gets the exception.
|
Optional<PointValue> |
getFirstPointValue()
Gets the first point value.
|
Optional<PointValue> |
getLastPointValue()
Gets the last point value.
|
Optional<StoreValuesQuery.Mark> |
getMark()
Gets the mark.
|
Optional<PointValue> |
getPointValue()
Gets the single point value.
|
PointValue |
getPointValue(int index)
Gets a specified point value.
|
List<PointValue> |
getPointValues()
Gets the point values.
|
Optional<StoreValuesQuery> |
getQuery()
Gets the store query.
|
int |
hashCode() |
boolean |
isComplete()
Asks if this response is complete.
|
boolean |
isEmpty() |
boolean |
isSuccess()
Asks if this a success response.
|
ListIterator<PointValue> |
iterator()
Returns a list iterator on the point values.
|
Optional<StoreValuesQuery.Mark> |
mark(int limit)
Creates a mark for the next point value.
|
void |
mark(Optional<UUID> pointUUID,
DateTime stamp,
int done)
Creates a mark for the next point value.
|
void |
mark(PointValue pointValue,
int done)
Creates a mark for the next point value.
|
void |
readExternal(ObjectInput input)
Reads in an external representation of this.
|
void |
restore(Points points)
Restores the references to the point definitions.
|
void |
reverse()
Reverses the order of values.
|
void |
setCount(long count)
Sets the count of values.
|
void |
setException(Exception exception)
Sets the exception.
|
void |
setQuery(Optional<StoreValuesQuery> query)
Sets the store query.
|
int |
size()
Returns the number of values in this Response.
|
String |
toString() |
void |
writeExternal(ObjectOutput output)
Writes out an external representation of this.
|
public StoreValues()
A default constructor as required for an externalizable.
public StoreValues(@Nonnull Exception exception)
exception
- The exception preventing a positive response.public StoreValues(@Nonnull StoreValuesQuery query)
query
- The store query selecting this.public boolean add(PointValue pointValue)
add
in interface Collection<PointValue>
add
in class AbstractCollection<PointValue>
pointValue
- The point value.public void clear()
clear
in interface Collection<PointValue>
clear
in class AbstractCollection<PointValue>
@Nonnull @CheckReturnValue public StoreValuesQuery createQuery()
This is used by a store's client when receiving a response with a
Mark
.
public boolean equals(Object object)
equals
in interface Collection<PointValue>
equals
in class Object
@CheckReturnValue public long getCount()
@Nonnull @CheckReturnValue public Optional<Exception> getException()
@Nonnull @CheckReturnValue public Optional<PointValue> getFirstPointValue()
@Nonnull @CheckReturnValue public Optional<PointValue> getLastPointValue()
@Nonnull @CheckReturnValue public Optional<StoreValuesQuery.Mark> getMark()
@Nonnull @CheckReturnValue public Optional<PointValue> getPointValue()
@CheckReturnValue public PointValue getPointValue(int index)
index
- The index of the point value.@CheckReturnValue public List<PointValue> getPointValues()
@Nonnull @CheckReturnValue public Optional<StoreValuesQuery> getQuery()
public int hashCode()
hashCode
in interface Collection<PointValue>
hashCode
in class Object
@CheckReturnValue public boolean isComplete()
When the response to a query is not complete, it contains a
Mark
which can be used
to create a query for the next values.
public boolean isEmpty()
isEmpty
in interface Collection<PointValue>
isEmpty
in class AbstractCollection<PointValue>
@CheckReturnValue public boolean isSuccess()
public ListIterator<PointValue> iterator()
iterator
in interface Iterable<PointValue>
iterator
in interface Collection<PointValue>
iterator
in class AbstractCollection<PointValue>
@Nonnull @CheckReturnValue public Optional<StoreValuesQuery.Mark> mark(int limit)
Used when pulling values.
limit
- The maximum number of values.public void mark(@Nonnull PointValue pointValue, int done)
Used by a store server when the store query's limit for the number of values is exceeded.
pointValue
- The next point value.done
- The number of values already produced.public void mark(@Nonnull Optional<UUID> pointUUID, @Nonnull DateTime stamp, int done)
pointUUID
- The optional UUID of the point of the next value.stamp
- The time stamp of the next value.done
- The number of values already produced.public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
input
- The external representation.IOException
- When an I/O error occurs.ClassNotFoundException
- From ObjectInput.readObject()
.public void restore(@Nonnull Points points)
points
- The points definitions.public void reverse()
public void setCount(long count)
count
- The count of values.public void setException(@Nonnull Exception exception)
exception
- The exception.public void setQuery(@Nonnull Optional<StoreValuesQuery> query)
query
- The optional store query.public int size()
size
in interface Collection<PointValue>
size
in class AbstractCollection<PointValue>
public String toString()
toString
in class AbstractCollection<PointValue>
public void writeExternal(ObjectOutput output) throws IOException
writeExternal
in interface Externalizable
output
- The external representation.IOException
- When an I/O error occurs.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.