org.apache.ignite.internal.processors.cache

## Class GridCacheReturn

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheReturn

All Implemented Interfaces:
  Externalizable, Serializable, Message

    public class GridCacheReturn
    extends Object
    implements Externalizable, Message

Return value for cases where both, value and success flag need to be returned.

See Also:
  Serialized Form

### Field Summary

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

`DIRECT_TYPE_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`GridCacheReturn()` Empty constructor.
`GridCacheReturn(boolean loc)`
`GridCacheReturn(boolean loc, boolean success)`
`GridCacheReturn(GridCacheContext cctx, boolean loc, boolean keepBinary, Object v, boolean success)`

### Method Summary

Methods
`void` `addEntryProcessResult(GridCacheContext cctx, KeyCacheObject key, Object key0, Object res, Exception err, boolean keepBinary)`
`int` `cacheId()`
`short` `directType()` Gets message type.
`boolean` `emptyResult()`
`byte` `fieldsCount()` Gets fields count.
`void` `finishUnmarshal(GridCacheContext ctx, ClassLoader ldr)`
`boolean` `invokeResult()`
`void` `invokeResult(boolean invokeRes)`
`void` `mergeEntryProcessResults(GridCacheReturn other)`
`void` `onAckReceived()` Method called when ack message received.
`void` `prepareMarshal(GridCacheContext ctx)`
`void` `readExternal(ObjectInput in)`
`boolean` `readFrom(ByteBuffer buf, MessageReader reader)` Reads this message from provided byte buffer.
`GridCacheReturn` `set(GridCacheContext cctx, CacheObject cacheObj, boolean success, boolean keepBinary)`
`boolean` `success()`
`GridCacheReturn` `success(boolean success)`
`String` `toString()`
`<V> V` `value()`
`GridCacheReturn` `value(GridCacheContext cctx, CacheObject v, boolean keepBinary)`
`void` `writeExternal(ObjectOutput out)`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.

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

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

### Constructor Detail

#### GridCacheReturn

    public GridCacheReturn()

Empty constructor.

#### GridCacheReturn

    public GridCacheReturn(boolean loc)

Parameters:
  `loc` - `True` if created on the node initiated cache operation.

#### GridCacheReturn

    public GridCacheReturn(boolean loc,
                   boolean success)

Parameters:
  `loc` - `True` if created on the node initiated cache operation.
  `success` - Success flag.

#### GridCacheReturn

    public GridCacheReturn(GridCacheContext cctx,
                   boolean loc,
                   boolean keepBinary,
                   Object v,
                   boolean success)

Parameters:
  `cctx` - Cache context.
  `loc` - `True` if created on the node initiated cache operation.
  `v` - Value.
  `success` - Success flag.

### Method Detail

#### value

    @Nullable
    public <V> V value()

Returns:
  Value.

#### emptyResult

    public boolean emptyResult()

#### invokeResult

    public boolean invokeResult()

Returns:
  If return is invoke result.

#### invokeResult

    public void invokeResult(boolean invokeRes)

Parameters:
  `invokeRes` - Invoke result flag.

#### value

    public GridCacheReturn value(GridCacheContext cctx,
                        CacheObject v,
                        boolean keepBinary)

Parameters:
  `cctx` - Cache context.
  `v` - Value.
Returns:
  This instance for chaining.

#### success

    public boolean success()

Returns:
  Success flag.

#### set

    public GridCacheReturn set(GridCacheContext cctx,
                      @Nullable
                      CacheObject cacheObj,
                      boolean success,
                      boolean keepBinary)

Parameters:
  `cctx` - Cache context.
  `cacheObj` - Value to set.
  `success` - Success flag to set.
  `keepBinary` - Keep binary flag.
Returns:
  This instance for chaining.

#### success

    public GridCacheReturn success(boolean success)

Parameters:
  `success` - Success flag.
Returns:
  This instance for chaining.

#### addEntryProcessResult

    public void addEntryProcessResult(GridCacheContext cctx,
                             KeyCacheObject key,
                             @Nullable
                             Object key0,
                             @Nullable
                             Object res,
                             @Nullable
                             Exception err,
                             boolean keepBinary)

Parameters:
  `cctx` - Context.
  `key` - Key.
  `key0` - Key value.
  `res` - Result.
  `err` - Error.
  `keepBinary` - Keep binary.

#### cacheId

    public int cacheId()

Returns:
  Cache ID.

#### mergeEntryProcessResults

    public void mergeEntryProcessResults(GridCacheReturn other)

Parameters:
  `other` - Other result to merge with.

#### prepareMarshal

    public void prepareMarshal(GridCacheContext ctx)
                        throws IgniteCheckedException

Parameters:
  `ctx` - Cache context.
Throws:
  `IgniteCheckedException` - If failed.

#### finishUnmarshal

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

Parameters:
  `ctx` - Cache context.
  `ldr` - Class loader.
Throws:
  `IgniteCheckedException` - If failed.

#### onAckReceived

    public void onAckReceived()

Method called when ack message received.

Specified by:
  `onAckReceived` in interface `Message`

#### directType

    public short directType()

Gets message type.

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

#### writeTo

    public boolean writeTo(ByteBuffer buf,
                  MessageWriter writer)

Writes this message to provided byte buffer.

Specified by:
  `writeTo` in interface `Message`
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`
Parameters:
  `buf` - Byte buffer.
  `reader` - Reader.
Returns:
  Whether message was fully read.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

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

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.2.0
Release Date | : September 15 2017