public class ReturnDefaultValueAction extends java.lang.Object implements Action
java.util.Imposteriser.null.| Modifier and Type | Field and Description |
|---|---|
private static java.lang.Class<?>[] |
CONCRETE_COLLECTION_TYPES |
private Imposteriser |
imposteriser |
private java.util.Map<java.lang.Class<?>,java.lang.Object> |
resultValuesByType |
| Constructor and Description |
|---|
ReturnDefaultValueAction() |
ReturnDefaultValueAction(Imposteriser imposteriser) |
ReturnDefaultValueAction(Imposteriser imposteriser,
java.util.Map<java.lang.Class<?>,java.lang.Object> typeToResultValue) |
| Modifier and Type | Method and Description |
|---|---|
void |
addResult(java.lang.Class<?> resultType,
java.lang.Object resultValue) |
private static boolean |
cannotCreateNewInstance(java.lang.Class<?> returnType) |
private static java.lang.Object |
collectionOrMapInstanceFor(java.lang.Class<?> returnType) |
protected static java.util.Map<java.lang.Class<?>,java.lang.Object> |
createDefaultResults() |
void |
describeTo(org.hamcrest.Description description) |
private static java.lang.Object |
instanceForCollectionType(java.lang.Class<?> type) |
java.lang.Object |
invoke(Invocation invocation)
Performs an action in response to an invocation.
|
private static boolean |
isCollectionOrMap(java.lang.Class<?> type) |
void |
setImposteriser(Imposteriser newImposteriser) |
private static final java.lang.Class<?>[] CONCRETE_COLLECTION_TYPES
private final java.util.Map<java.lang.Class<?>,java.lang.Object> resultValuesByType
private Imposteriser imposteriser
public ReturnDefaultValueAction(Imposteriser imposteriser, java.util.Map<java.lang.Class<?>,java.lang.Object> typeToResultValue)
public ReturnDefaultValueAction(Imposteriser imposteriser)
public ReturnDefaultValueAction()
public void setImposteriser(Imposteriser newImposteriser)
public void describeTo(org.hamcrest.Description description)
describeTo in interface org.hamcrest.SelfDescribingpublic void addResult(java.lang.Class<?> resultType,
java.lang.Object resultValue)
public java.lang.Object invoke(Invocation invocation) throws java.lang.Throwable
Invokableinvoke in interface Invokableinvocation - The invocation to perform.null if the invoked method has a void return type.java.lang.Throwable - An exception to be thrown to the caller, if not returning a value. Any checked exception
thrown must be in the throws list of the invoked method.private static java.lang.Object collectionOrMapInstanceFor(java.lang.Class<?> returnType)
throws java.lang.Throwable
java.lang.Throwableprivate static java.lang.Object instanceForCollectionType(java.lang.Class<?> type)
throws java.lang.Throwable
java.lang.Throwableprivate static boolean isCollectionOrMap(java.lang.Class<?> type)
private static boolean cannotCreateNewInstance(java.lang.Class<?> returnType)
protected static java.util.Map<java.lang.Class<?>,java.lang.Object> createDefaultResults()