org.xins.client.AbstractCAPICallResult Maven / Gradle / Ivy
/*
* $Id: AbstractCAPICallResult.java,v 1.16 2006/08/28 09:12:30 agoubard Exp $
*
* Copyright 2003-2006 Orange Nederland Breedband B.V.
* See the COPYRIGHT file for redistribution and use restrictions.
*/
package org.xins.client;
import java.io.Serializable;
import org.xins.common.MandatoryArgumentChecker;
import org.xins.common.service.CallExceptionList;
import org.xins.common.service.TargetDescriptor;
/**
* Base class for generated CAPI function result classes.
*
* This class should not be subclassed manually. It is only intended to be
* subclassed by classes generated by XINS.
*
* @version $Revision: 1.16 $ $Date: 2006/08/28 09:12:30 $
* @author Ernst de Haan
*
* @since XINS 1.0.0
*/
public abstract class AbstractCAPICallResult implements Serializable {
//-------------------------------------------------------------------------
// Constructors
//-------------------------------------------------------------------------
/**
* Creates a new AbstractCAPICallResult
object, based on the
* specified XINSCallResult
.
*
* @param result
* the lower-level {@link XINSCallResult}, cannot be null
.
*
* @throws IllegalArgumentException
* if result == null
.
*/
protected AbstractCAPICallResult(XINSCallResult result)
throws IllegalArgumentException {
// Check preconditions
MandatoryArgumentChecker.check("result", result);
// Store field
_result = result;
// Check preconditions
if (result.getErrorCode() != null) {
throw new java.lang.IllegalArgumentException(
"result.getErrorCode() != null");
}
}
//-------------------------------------------------------------------------
// Fields
//-------------------------------------------------------------------------
/**
* The XINS call result. This field cannot be null
.
*/
private XINSCallResult _result;
//-------------------------------------------------------------------------
// Methods
//-------------------------------------------------------------------------
/**
* Returns the underlying XINS call result.
*
* @return
* the underlying {@link XINSCallResult} object, never
* null
.
*/
XINSCallResult getXINSCallResult() {
return _result;
}
/**
* Returns the target for which the call succeeded.
*
* @return
* the {@link TargetDescriptor} for which the call succeeded, not
* null
.
*
* @since XINS 1.1.0
*/
public final TargetDescriptor succeededTarget() {
return _result.getSucceededTarget();
}
/**
* Returns the call duration, in milliseconds.
*
* @return
* the duration of the succeeded call, in milliseconds, guaranteed to
* be a non-negative number.
*
* @since XINS 1.1.0
*/
public final long duration() {
// TODO: Duration of succeeded call or of the complete attempt?
return _result.getDuration();
}
/**
* Returns the list of CallException
s.
*
* @return
* the {@link org.xins.common.service.CallException}s,
* collected in a {@link CallExceptionList} object,
* or null
if the first call attempt succeeded.
*
* @since XINS 1.1.0
*/
public final CallExceptionList exceptions() {
return _result.getExceptions();
}
}