public abstract class ACallContractor extends Object implements ICallContractor
The purpose of this is to ease the burden of concrete implementations.
To extend this in a concrete implementation is optional.
Modifier | Constructor and Description |
---|---|
protected |
ACallContractor()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Long |
getCurrentThreadId() |
protected Object |
getSynchronizationObject() |
protected HashMap<Long,Object> |
getThreadId2Caller() |
protected HashMap<Long,Object[]> |
getThreadId2CheckArguments() |
protected HashMap<Long,Object[]> |
getThreadId2CheckExtraArguments() |
protected HashMap<Long,Class<? extends IFail>> |
getThreadId2FailSpecification() |
AbstractMap.SimpleEntry<Object[],Object[]> |
popContractWithCaller(Object caller,
IFailer throwingFailer,
Class<? extends IFail> failSpecification)
Ends a contract between caller and call contractor.
|
void |
pushContractWithCaller(Object caller,
IChecker assertingChecker,
Class<? extends ICheck> checkSpecification,
Object[] checkArguments,
Object[] checkExtraArguments)
Starts a contract between caller and call contractor.
|
protected void |
setSynchronizationObject(Object synchronizationObject) |
protected void |
setThreadId2Caller(HashMap<Long,Object> threadId2Caller) |
protected void |
setThreadId2CheckArguments(HashMap<Long,Object[]> threadId2CheckArguments) |
protected void |
setThreadId2CheckExtraArguments(HashMap<Long,Object[]> threadId2CheckExtraArguments) |
protected void |
setThreadId2FailSpecification(HashMap<Long,Class<? extends IFail>> threadId2FailSpecification) |
public void pushContractWithCaller(Object caller, IChecker assertingChecker, Class<? extends ICheck> checkSpecification, Object[] checkArguments, Object[] checkExtraArguments)
ICallContractor
Argument checkSpecification is annotated with a matching fail specification that needs to be employed by the caller to end the contract.
pushContractWithCaller
in interface ICallContractor
caller
- instance that called a checker and needs to call a failerassertingChecker
- checker that was called and assertedcheckSpecification
- check specification type inheriting ICheckcheckArguments
- user supplied check arguments for failer outputcheckExtraArguments
- implementation supplied check arguments for failer outputpublic AbstractMap.SimpleEntry<Object[],Object[]> popContractWithCaller(Object caller, IFailer throwingFailer, Class<? extends IFail> failSpecification)
ICallContractor
Argument failSpecification is annotated with a matching check specification that was employed by the caller to start the contract.
popContractWithCaller
in interface ICallContractor
caller
- instance that called a checker and needs to call a failerthrowingFailer
- failer that was called to throw an exceptionfailSpecification
- fail specification type inhering by IFailprotected Object getSynchronizationObject()
protected void setSynchronizationObject(Object synchronizationObject)
protected HashMap<Long,Class<? extends IFail>> getThreadId2FailSpecification()
protected void setThreadId2FailSpecification(HashMap<Long,Class<? extends IFail>> threadId2FailSpecification)
protected void setThreadId2CheckArguments(HashMap<Long,Object[]> threadId2CheckArguments)
protected void setThreadId2CheckExtraArguments(HashMap<Long,Object[]> threadId2CheckExtraArguments)
protected Long getCurrentThreadId()
The MIT License (MIT) - Copyright © 2014-2015 Keld Oelykke. All Rights Reserved.