public abstract class DeltaStream extends DataValue
A stream of delta items, each of which is either an EntityValue
or a ChangedLink
.
While processing a stream, a delta link may be encountered, but it will not be immediately available to the caller. The DeltaStream.deltaLink
can be obtained only after the stream is closed.
let deltaStream = ...;
while (deltaStream.next())
{
if (deltaStream.hasEntity())
{
let entity = deltaStream.getEntity();
// Process entity value.
}
else
{
let link = deltaStream.getLink();
// Process changed link.
}
}
deltaStream.close();
var deltaLink = deltaStream.deltaLink;
// Save delta link for later use.
Constructor and Description |
---|
DeltaStream() |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Close this stream and release all associated resources, without checking first that the end of stream has been reached.
|
void |
close()
Close this stream and release all associated resources, checking first that the end of stream has been reached.
|
java.lang.Object |
getCurrent()
Return (nullable) the current delta item (an
EntityValue or ChangedLink ), or null if there is no current delta item. |
DataType |
getDataType()
Return data type with a
DataType.code of DataType.DELTA_STREAM. |
java.lang.Object |
getDeltaItem()
|
java.lang.String |
getDeltaLink()
Return (nullable) The delta-link (if any) that was encountered when
DeltaStream.next was called repeatedly until it returned false and then DeltaStream.close was called, otherwise null . |
EntityValue |
getEntity()
Return the current entity value.
|
ChangedLink |
getLink()
Return the current changed link.
|
java.lang.String |
getNextLink()
Return (nullable) The next-link (if any) that was encountered when
DeltaStream.next was called repeatedly until it returned false and then DeltaStream.close was called, otherwise null . |
java.lang.String |
getReadLink()
Return (nullable) The read-link (if any) that was encountered when
DeltaStream.next was called repeatedly until it returned false and then DeltaStream.close was called, otherwise null . |
boolean |
hasCurrent()
Return
true if the if the stream has a current delta item (the most recent call to DeltaStream.next returned true and DeltaStream.close has not been called)). |
boolean |
hasEntity()
Check if the stream has a current delta item which is an entity value.
|
boolean |
hasLink()
Check if the stream has a current delta item which is a changed link.
|
boolean |
isClosed()
Return has
DeltaStream.close been called? |
abstract boolean |
next()
If this stream has not been
DeltaStream.close and has a next delta item, then advance to the next delta item and return true . |
void |
setClosed(boolean value)
Set has
DeltaStream.close been called? |
void |
setDeltaItem(java.lang.Object value)
|
void |
setDeltaLink(java.lang.String value)
Set the delta-link (if any) that was encountered when
DeltaStream.next was called repeatedly until it returned false and then DeltaStream.close was called, otherwise null . |
void |
setNextLink(java.lang.String value)
Set the next-link (if any) that was encountered when
DeltaStream.next was called repeatedly until it returned false and then DeltaStream.close was called, otherwise null . |
void |
setReadLink(java.lang.String value)
Set the read-link (if any) that was encountered when
DeltaStream.next was called repeatedly until it returned false and then DeltaStream.close was called, otherwise null . |
java.lang.String |
toString()
Convert this data value to a string.
|
cloneMutable, equals, getTypeCode, hashCode
public void abort()
Close this stream and release all associated resources, without checking first that the end of stream has been reached.
public void close()
Close this stream and release all associated resources, checking first that the end of stream has been reached.
Can safely be called even if the stream was previously closed.
If a delta link was encountered before the stream was closed, it will be available via the DeltaStream.deltaLink
property only after the stream is closed.
If a next link was encountered before the stream was closed, it will be available via the DeltaStream.nextLink
property only after the stream is closed.
public java.lang.Object getCurrent()
Return (nullable) the current delta item (an EntityValue
or ChangedLink
), or null
if there is no current delta item.
EntityValue
or ChangedLink
), or `null` if there is no current delta item.public DataType getDataType()
Return data type with a DataType.code
of DataType.DELTA_STREAM.
getDataType
in class DataValue
DataType.code
of DataType.DELTA_STREAM.public java.lang.Object getDeltaItem()
Return (nullable) The current delta item (an EntityValue
or ChangedLink
), or null
.
EntityValue
or ChangedLink
), or null
.public java.lang.String getDeltaLink()
Return (nullable) The delta-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.
DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.public EntityValue getEntity()
Return the current entity value.
UsageException
if there no current delta item or if the current delta item is a changed link.
public ChangedLink getLink()
Return the current changed link.
UsageException
if there is no current delta item or if the current delta item is an entity value.
public java.lang.String getNextLink()
Return (nullable) The next-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.
DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.public java.lang.String getReadLink()
Return (nullable) The read-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.
DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.public boolean hasCurrent()
Return true
if the if the stream has a current delta item (the most recent call to DeltaStream.next
returned true
and DeltaStream.close
has not been called)).
DeltaStream.next
returned `true` and DeltaStream.close
has not been called)).public boolean hasEntity()
Check if the stream has a current delta item which is an entity value.
DeltaStream.hasCurrent
would return `true` if called, and the current delta item is an entity value.public boolean hasLink()
Check if the stream has a current delta item which is a changed link.
DeltaStream.hasCurrent
would return `true` if called, and the current delta item is a changed link.public boolean isClosed()
Return has DeltaStream.close
been called?
DeltaStream.close
been called?public abstract boolean next()
If this stream has not been DeltaStream.close
and has a next delta item, then advance to the next delta item and return true
. Otherwise return false
.
public void setClosed(boolean value)
Set has DeltaStream.close
been called?
value
- Has DeltaStream.close
been called?public void setDeltaItem(java.lang.Object value)
Set the current delta item (an EntityValue
or ChangedLink
), or null
.
value
- The current delta item (an EntityValue
or ChangedLink
), or null
.public void setDeltaLink(java.lang.String value)
Set the delta-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.
value
- The delta-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.public void setNextLink(java.lang.String value)
Set the next-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.
value
- The next-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.public void setReadLink(java.lang.String value)
Set the read-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.
value
- The read-link (if any) that was encountered when DeltaStream.next
was called repeatedly until it returned false
and then DeltaStream.close
was called, otherwise null
.public java.lang.String toString()
Convert this data value to a string.
If the DeltaStream.dataType
is defined by XML Schema Part 2: Datatypes, then the corresponding lexical format is used.
JSON format is used for structured values (arrays and objects).