use of com.navercorp.pinpoint.thrift.dto.TResult in project pinpoint by naver.
the class ThriftMessageToResultConverter method toMessage.
@Override
public ResultResponse toMessage(Object object) {
if (object instanceof ResponseMessage) {
final ResponseMessage responseMessage = (ResponseMessage) object;
final byte[] byteMessage = responseMessage.getMessage();
final Message<TBase<?, ?>> message = SerializationUtils.deserialize(byteMessage, HeaderTBaseDeserializerFactory.DEFAULT_FACTORY, null);
if (message == null) {
throw new IllegalArgumentException("message is null. response message=" + responseMessage);
}
final TBase<?, ?> tbase = message.getData();
if (!(tbase instanceof TResult)) {
throw new IllegalArgumentException("invalid message data. response message=" + responseMessage + ", data=" + tbase.getClass());
}
final TResult result = (TResult) tbase;
return new ResultResponse() {
@Override
public boolean isSuccess() {
return result.isSuccess();
}
@Override
public String getMessage() {
return result.getMessage();
}
};
}
return null;
}
Aggregations