com.alibaba.dubbo.rpc
Class RpcResult

java.lang.Object
  extended by com.alibaba.dubbo.rpc.RpcResult
All Implemented Interfaces:
Result, Serializable
Direct Known Subclasses:
DecodeableRpcResult

public class RpcResult
extends Object
implements Result, Serializable

RPC Result.

Author:
qianlei
See Also:
Serialized Form

Constructor Summary
RpcResult()
           
RpcResult(Object result)
           
RpcResult(Throwable exception)
           
 
Method Summary
 String getAttachment(String key)
          get attachment by key.
 String getAttachment(String key, String defaultValue)
          get attachment by key with default value.
 Map<String,String> getAttachments()
          get attachments.
 Throwable getException()
          Get exception.
 Object getResult()
          Deprecated. Replace to getValue()
 Object getValue()
          Get invoke result.
 boolean hasException()
          Has exception.
 Object recreate()
          Recreate.
 void setAttachment(String key, String value)
           
 void setAttachments(Map<String,String> map)
           
 void setException(Throwable e)
           
 void setResult(Object result)
          Deprecated. Replace to setValue()
 void setValue(Object value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RpcResult

public RpcResult()

RpcResult

public RpcResult(Object result)

RpcResult

public RpcResult(Throwable exception)
Method Detail

recreate

public Object recreate()
                throws Throwable
Description copied from interface: Result
Recreate.

if (hasException()) { throw getException(); } else { return getValue(); }

Specified by:
recreate in interface Result
Returns:
result.
Throws:
Throwable

getResult

@Deprecated
public Object getResult()
Deprecated. Replace to getValue()

Specified by:
getResult in interface Result
See Also:
getValue()

setResult

@Deprecated
public void setResult(Object result)
Deprecated. Replace to setValue()

See Also:
com.alibaba.dubbo.rpc.RpcResult#setValue()

getValue

public Object getValue()
Description copied from interface: Result
Get invoke result.

Specified by:
getValue in interface Result
Returns:
result. if no result return null.

setValue

public void setValue(Object value)

getException

public Throwable getException()
Description copied from interface: Result
Get exception.

Specified by:
getException in interface Result
Returns:
exception. if no exception return null.

setException

public void setException(Throwable e)

hasException

public boolean hasException()
Description copied from interface: Result
Has exception.

Specified by:
hasException in interface Result
Returns:
has exception.

getAttachments

public Map<String,String> getAttachments()
Description copied from interface: Result
get attachments.

Specified by:
getAttachments in interface Result
Returns:
attachments.

setAttachments

public void setAttachments(Map<String,String> map)

getAttachment

public String getAttachment(String key)
Description copied from interface: Result
get attachment by key.

Specified by:
getAttachment in interface Result
Returns:
attachment value.

getAttachment

public String getAttachment(String key,
                            String defaultValue)
Description copied from interface: Result
get attachment by key with default value.

Specified by:
getAttachment in interface Result
Returns:
attachment value.

setAttachment

public void setAttachment(String key,
                          String value)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012–2017 Alibaba. All rights reserved.