public static interface DataSerializer.DataAttributeInflatable extends DataSerializer
getAttributeContexts(String...) method,
returning a user defined context object. The context object is cached and passed to the
inflateDataObjectAttributes(DataObjectContext, XsDataInputStream, Object) method to
inflate the specified attributes.
For each call to getAttributeContexts(String...) for a set of attribute paths,
there will typically be more than one call to inflateDataObjectAttributes(DataObjectContext, XsDataInputStream, Object).
The getAttributeContexts(String...) can, therefore, be used to optimize
calculation, allocation or other processing that might normally be done during the call
to {#link inflateDataObjectAttributes(DataObjectContext, XsDataInputStream, Object).
This mix-in interface is required when using ObjectQuery or the HashIndex plug-in.
DataSerializer.DataAttributeInflatable, DataSerializer.Identifiable, DataSerializer.SpecialValue, DataSerializer.UserReadable| Modifier and Type | Method and Description |
|---|---|
Object |
getAttributeContexts(String... attributePaths)
Retrieve a context from the specified attribute paths.
|
Object[] |
inflateDataObjectAttributes(DataObjectContext dataObjectContext,
XsDataInputStream dataObjectInput,
Object attributeContexts)
From the specified data input stream, inflate the specified attributes.
|
inflateDataObject, serializeDataObjectObject getAttributeContexts(String... attributePaths)
inflateDataObjectAttributes(DataObjectContext, XsDataInputStream, Object)
and is used to identify the paths that will be inflated. The resulting attribute context object is passed
to the inflateDataObjectAttributes method as-is.This is useful for returning optimized data structures for the implementation. For example, returning int[] instead of String[] to identify each attribute to extract.
attributePaths - the non-null strings that identify attributes that this DataSerializer can
inflate.inflateDataObjectAttributes(DataObjectContext, XsDataInputStream, Object)
method of the same DataSerializer instance. The resulting object must
not be null.Object[] inflateDataObjectAttributes(DataObjectContext dataObjectContext, XsDataInputStream dataObjectInput, Object attributeContexts) throws IOException
If the attribute doesn't exist, DataSerializer.SpecialValue.NOT_FOUND must be returned.
Attributes with isCollection() set to true, must return Collections. Collections of primitive
objects must return primitive type wrapper collections.
For example: Collection
Embedded attributes are returned as the native data type, such that it can be used
directly with the DataSerializer.serializeDataObject(DataObjectContext, Object, XsDataOutputStream) method..
For example:
Person {
Name: String,
Address : {
Street: String,
City: String,
State: String
}
}
Object attrCtx = getAttributeContext("Address");
inflateDataObjectAttributes(..., attrCtx) would return:
{
Street: String,
City: String,
State: String
}
Object attrCtx = getAttributeContext("Name");
inflateDataObjectAttributes(..., attrCtx) would return:
"John Doe"
Do not store or use the data stream beyond the confines of this method call. The data stream is owned by the WebSphere eXtreme Scale framework and my be closed, pooled or reused as required.
dataObjectContext - the context of the method call.dataObjectInput - the data input stream to read the object, produced from
DataSerializer.serializeDataObject(DataObjectContext, Object, XsDataOutputStream).
Must not be null.attributeContexts - the context of the attributes to retrieve from the input stream. Must not be null.DataSerializer.SpecialValue.NOT_FOUND for any values not found.IOException - thrown if there is a problem reading the data.