com.tencent.tcaplus.client
Interface Request


public interface Request

the request interface

Version:
Version 1.0
Author:
yahuiwang,elviszhu

Method Summary
 void addFieldName(java.lang.String fieldName)
          add a fieldName,used in get, batchget operations
 Record addRecord()
          add a record in the request
 int getCmd()
          get the operation type
 int getMultiResponseFlag()
          get multi-response flag
 int getResultFlag()
          get the result flag
 int getSequence()
          get the request sequence
 java.lang.String getTableName()
          get the tableName
 byte[] getUserData()
          get the user defined data
 void setCmd(int cmd)
          set the operation type
 void setFieldName(java.util.List<java.lang.String> fieldNames)
          set the value fieldNames once a batch,used in get, batchget operations
 void setMultiResponseFlag(int multiFlag)
          set the multi-response flag
 void setResultFlag(int resultFlag)
          For performance optimizing, you can set the resultFlag to decide what to return in the response.
 void setSequence(int seq)
          set the request sequence
 void setTableName(java.lang.String tableName)
          set the tableName
 void setUserData(byte[] data)
          set the user defined data, which will be return all the same in the response
 java.lang.String toString()
          visualize the content
 

Method Detail

setCmd

void setCmd(int cmd)
            throws com.tencent.tcaplus.util.TCaplusException
set the operation type

Throws:
com.tencent.tcaplus.util.TCaplusException

getCmd

int getCmd()
           throws com.tencent.tcaplus.util.TCaplusException
get the operation type

Returns:
int: the operation type, TCAPLUS_API_INVALID_REQ returned when setCmd not call before
Throws:
com.tencent.tcaplus.util.TCaplusException

setTableName

void setTableName(java.lang.String tableName)
                  throws com.tencent.tcaplus.util.TCaplusException
set the tableName

Parameters:
String - tableName: the tableName, max size:256 bytes
Throws:
com.tencent.tcaplus.util.TCaplusException

getTableName

java.lang.String getTableName()
                              throws com.tencent.tcaplus.util.TCaplusException
get the tableName

Returns:
String: the tableName
Throws:
com.tencent.tcaplus.util.TCaplusException

setUserData

void setUserData(byte[] data)
                 throws com.tencent.tcaplus.util.TCaplusException
set the user defined data, which will be return all the same in the response

Parameters:
byte[] - data: the user defined data, max size: 1024 bytes
Throws:
com.tencent.tcaplus.util.TCaplusException

getUserData

byte[] getUserData()
                   throws com.tencent.tcaplus.util.TCaplusException
get the user defined data

Returns:
byte[]: the user defined data, null returned when not set
Throws:
com.tencent.tcaplus.util.TCaplusException

setSequence

void setSequence(int seq)
set the request sequence

Parameters:
int - seq: the request sequence

getSequence

int getSequence()
get the request sequence

Returns:
int: the request sequence

setResultFlag

void setResultFlag(int resultFlag)
                   throws com.tencent.tcaplus.util.TCaplusException
For performance optimizing, you can set the resultFlag to decide what to return in the response. used in the GenericTable Operation,including:insert,increase,replace,delete

Parameters:
int - resultFlag: result flag
  • TcaplusProtocolCsConstants.TCaplusValueFlag_NOVALUE: only return the operation is successful or not
  • TcaplusProtocolCsConstants.TCaplusValueFlag_SAMEWITHREQUEST: return the updated fields content
  • TcaplusProtocolCsConstants.TCaplusValueFlag_ALLVALUE: return all the fields content
  • TcaplusProtocolCsConstants.TCaplusValueFlag_ALLOLDVALUE the old value be returned when replace an update
Throws:
com.tencent.tcaplus.util.TCaplusException

getResultFlag

int getResultFlag()
get the result flag

Returns:
int: the result flag

addRecord

Record addRecord()
                 throws com.tencent.tcaplus.util.TCaplusException
add a record in the request

Returns:
Record: a record object
Throws:
com.tencent.tcaplus.util.TCaplusException

setFieldName

void setFieldName(java.util.List<java.lang.String> fieldNames)
                  throws com.tencent.tcaplus.util.TCaplusException
set the value fieldNames once a batch,used in get, batchget operations

Parameters:
List - fieldNames: set the value fieldNames once a batch
Throws:
com.tencent.tcaplus.util.TCaplusException

addFieldName

void addFieldName(java.lang.String fieldName)
                  throws com.tencent.tcaplus.util.TCaplusException
add a fieldName,used in get, batchget operations

Throws:
com.tencent.tcaplus.util.TCaplusException

setMultiResponseFlag

void setMultiResponseFlag(int multiFlag)
                          throws com.tencent.tcaplus.util.TCaplusException
set the multi-response flag

Parameters:
int - multiFlag: 1: true, 0:false
Throws:
com.tencent.tcaplus.util.TCaplusException
See Also:
used in the BatchGet operation

getMultiResponseFlag

int getMultiResponseFlag()
                         throws com.tencent.tcaplus.util.TCaplusException
get multi-response flag

Returns:
int: the multi-response flag, 1: true, 0:false
Throws:
com.tencent.tcaplus.util.TCaplusException
See Also:
used in the BatchGet operation

toString

java.lang.String toString()
                          throws com.tencent.tcaplus.util.TCaplusException
visualize the content

Overrides:
toString in class java.lang.Object
Returns:
String: the visualized string
Throws:
com.tencent.tcaplus.util.TCaplusException