/*

 * Asynchronous Engine .

 * 

 * Copyright (C) 2004 Claude Hussenet

 * Contact : chussenet@yahoo.com

 * 

 * Distributable under LGPL license.

 * See terms of license at gnu.org.

 */

package org.jboss.aspects.asynchronous.common;

import org.jboss.aspects.asynchronous.AsynchronousConstants;
import org.jboss.aspects.asynchronous.AsynchronousResponse;

/**
 * @author <a href="mailto:chussenet@yahoo.com">{Claude Hussenet Independent Consultant}</a>.
 * @version <tt>$Revision: 1.2.4.3 $</tt>
 */

public class AsynchronousResponseImpl

implements AsynchronousResponse, AsynchronousConstants
{

   private int _code = 0;

   private String _reason = null;

   private Object _result = null;

   public AsynchronousResponseImpl(int code, String reason, Object object)
   {

      _code = code;

      _reason = reason;

      _result = object;

   }

   public AsynchronousResponseImpl(int code, Object object)
   {

      _code = code;

      _result = object;

   }

   public int getResponseCode()
   {

      return _code;

   }

   public String getReason()
   {

      return _reason;

   }

   public Object getResult()
   {

      return _result;

   }

   public String toString()
   {

      return new StringBuffer(" Rc:")

      .append(getResponseCode())

      .append(getReason() != null ? " Re:" : "")

      .append(getReason() != null ? getReason() : "")

      .append(getResponseCode() != OK ? " Rs:" : "")

      .append(getResponseCode() != OK ? getResult() : "")

      .toString();

   }

}

