org.apache.ignite.internal.processors.cache.query

## Class GridCacheQueryResponse

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheMessage
  - - org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse

All Implemented Interfaces:
  Serializable, GridCacheDeployable, Message

    public class GridCacheQueryResponse
    extends GridCacheMessage
    implements GridCacheDeployable

Query request.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheMessage

`addDepInfo, CACHE_MSG_INDEX_FIELD_NAME, cacheId, forceAddDepInfo, MAX_CACHE_MSG_LOOKUP_INDEX`

### Fields inherited from interface org.apache.ignite.plugin.extensions.communication.Message

`DIRECT_TYPE_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`GridCacheQueryResponse()` Empty constructor for `Externalizable`
`GridCacheQueryResponse(int cacheId, long reqId, boolean finished, boolean fields, boolean addDepInfo)`
`GridCacheQueryResponse(int cacheId, long reqId, Throwable err, boolean addDepInfo)`

### Method Summary

Methods
`boolean` `addDeploymentInfo()` Deployment enabled flag indicates whether deployment info has to be added to this message.
`Collection<Object>` `data()`
`void` `data(Collection<?> data)`
`short` `directType()` Gets message type.
`Throwable` `error()`
`boolean` `fields()`
`byte` `fieldsCount()` Gets fields count.
`void` `finished(boolean finished)`
`void` `finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr)` This method is called after the message is deserialized and is responsible for unmarshalling state marshalled in `GridCacheMessage.prepareMarshal(GridCacheSharedContext)` method.
`boolean` `isFinished()`
`List<GridQueryFieldMetadata>` `metadata()`
`void` `metadata(List<GridQueryFieldMetadata> metadata)`
`void` `prepareMarshal(GridCacheSharedContext ctx)` This method is called before the whole message is serialized and is responsible for pre-marshalling state.
`boolean` `readFrom(ByteBuffer buf, MessageReader reader)` Reads this message from provided byte buffer.
`long` `requestId()`
`String` `toString()`
`protected <T> List<T>` `unmarshalCollection0(Collection<byte[]> byteCol, GridCacheSharedContext ctx, ClassLoader ldr)`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheMessage

`appendFlag, cacheId, cacheId, classError, deployInfo, finishUnmarshalCacheObjects, finishUnmarshalCacheObjects, ignoreClassErrors, lookupIndex, marshalCollection, marshalInfo, marshalInfos, marshalInvokeArguments, marshalTx, messageId, messageLogger, nextIndexId, onAckReceived, onClassError, partition, partitionExchangeMessage, prepare, prepareMarshalCacheObject, prepareMarshalCacheObjects, prepareMarshalCacheObjects, prepareObject, topologyVersion, transferExpiryPolicy, unmarshalCollection, unmarshalInfo, unmarshalInfos, unmarshalInvokeArguments, unmarshalTx`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheDeployable

`deployInfo, prepare`

### Constructor Detail

#### GridCacheQueryResponse

    public GridCacheQueryResponse()

Empty constructor for `Externalizable`

#### GridCacheQueryResponse

    public GridCacheQueryResponse(int cacheId,
                          long reqId,
                          boolean finished,
                          boolean fields,
                          boolean addDepInfo)

Parameters:
  `cacheId` - Cache ID.
  `reqId` - Request id.
  `finished` - Last response or not.
  `fields` - Fields query or not.
  `addDepInfo` - Deployment info flag.

#### GridCacheQueryResponse

    public GridCacheQueryResponse(int cacheId,
                          long reqId,
                          Throwable err,
                          boolean addDepInfo)

Parameters:
  `cacheId` - Cache ID.
  `reqId` - Request id.
  `err` - Error.
  `addDepInfo` - Deployment info flag.

### Method Detail

#### prepareMarshal

    public void prepareMarshal(GridCacheSharedContext ctx)
                        throws IgniteCheckedException

This method is called before the whole message is serialized and is responsible for pre-marshalling state.

Overrides:
  `prepareMarshal` in class `GridCacheMessage`
Parameters:
  `ctx` -
Throws:
  `IgniteCheckedException` - If failed.

#### finishUnmarshal

    public void finishUnmarshal(GridCacheSharedContext ctx,
                       ClassLoader ldr)
                         throws IgniteCheckedException

This method is called after the message is deserialized and is responsible for unmarshalling state marshalled in `GridCacheMessage.prepareMarshal(GridCacheSharedContext)` method.

Overrides:
  `finishUnmarshal` in class `GridCacheMessage`
Parameters:
  `ctx` - Context.
  `ldr` - Class loader.
Throws:
  `IgniteCheckedException` - If failed.

#### unmarshalCollection0

    @Nullable
    protected <T> List<T> unmarshalCollection0(@Nullable
                                            Collection<byte[]> byteCol,
                                            GridCacheSharedContext ctx,
                                            ClassLoader ldr)
                                    throws IgniteCheckedException

Parameters:
  `byteCol` - Collection to unmarshal.
  `ctx` - Context.
  `ldr` - Loader.
Returns:
  Unmarshalled collection.
Throws:
  `IgniteCheckedException` - If failed.

#### addDeploymentInfo

    public boolean addDeploymentInfo()

Deployment enabled flag indicates whether deployment info has to be added to this message.

Specified by:
  `addDeploymentInfo` in class `GridCacheMessage`
Returns:
  `true` or if deployment info must be added to the the message, `false` otherwise.

#### metadata

    public List<GridQueryFieldMetadata> metadata()

Returns:
  Metadata.

#### metadata

    public void metadata(@Nullable
                List<GridQueryFieldMetadata> metadata)

Parameters:
  `metadata` - Metadata.

#### data

    public Collection<Object> data()

Returns:
  Query data.

#### data

    public void data(Collection<?> data)

Parameters:
  `data` - Query data.

#### isFinished

    public boolean isFinished()

Returns:
  If this is last response for this request or not.

#### finished

    public void finished(boolean finished)

Parameters:
  `finished` - If this is last response for this request or not.

#### requestId

    public long requestId()

Returns:
  Request id.

#### error

    public Throwable error()

Overrides:
  `error` in class `GridCacheMessage`
Returns:
  Error, if any.

#### fields

    public boolean fields()

Returns:
  If fields query.

#### writeTo

    public boolean writeTo(ByteBuffer buf,
                  MessageWriter writer)

Writes this message to provided byte buffer.

Specified by:
  `writeTo` in interface `Message`
Overrides:
  `writeTo` in class `GridCacheMessage`
Parameters:
  `buf` - Byte buffer.
  `writer` - Writer.
Returns:
  Whether message was fully written.

#### readFrom

    public boolean readFrom(ByteBuffer buf,
                   MessageReader reader)

Reads this message from provided byte buffer.

Specified by:
  `readFrom` in interface `Message`
Overrides:
  `readFrom` in class `GridCacheMessage`
Parameters:
  `buf` - Byte buffer.
  `reader` - Reader.
Returns:
  Whether message was fully read.

#### directType

    public short directType()

Gets message type.

Specified by:
  `directType` in interface `Message`
Returns:
  Message type.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

Specified by:
  `fieldsCount` in interface `Message`
Returns:
  Fields count.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridCacheMessage`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017