Package org.robolectric.shadow.api
Class Shadow
- java.lang.Object
-
- org.robolectric.shadow.api.Shadow
-
public class Shadow extends Object
-
-
Constructor Summary
Constructors Constructor Description Shadow()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voiddirectInitialize(Class<?> clazz)static <R,T>
RdirectlyOn(Class<T> clazz, String methodName, ReflectionHelpers.ClassParameter... paramValues)static <R> RdirectlyOn(Object shadowedObject, String clazzName, String methodName, ReflectionHelpers.ClassParameter... paramValues)static <T> TdirectlyOn(T shadowedObject, Class<T> clazz)Deprecated.This is incompatible with JDK17+.static <R,T>
RdirectlyOn(T shadowedObject, Class<T> clazz, String methodName, ReflectionHelpers.ClassParameter... paramValues)static StringdirectMethodName(String className, String methodName)static <T> Textract(Object instance)Retrieve corresponding Shadow of the object.static <R> RinvokeConstructor(Class<? extends R> clazz, R instance, ReflectionHelpers.ClassParameter... paramValues)static <T> TnewInstance(Class<T> clazz, Class[] parameterTypes, Object[] params)static <T> TnewInstanceOf(Class<T> clazz)static ObjectnewInstanceOf(String className)
-
-
-
Method Detail
-
extract
public static <T> T extract(Object instance)
Retrieve corresponding Shadow of the object.- Since:
- 3.3
-
newInstanceOf
public static <T> T newInstanceOf(Class<T> clazz)
-
newInstance
public static <T> T newInstance(Class<T> clazz, Class[] parameterTypes, Object[] params)
-
directlyOn
@Deprecated public static <T> T directlyOn(T shadowedObject, Class<T> clazz)
Returns a proxy object that invokes the original $$robo$$-prefixed methods whenever a method on the proxy is invoked. This is primarily used to invoke original methods in shadow implementations.
-
directlyOn
public static <R> R directlyOn(Object shadowedObject, String clazzName, String methodName, ReflectionHelpers.ClassParameter... paramValues)
-
directlyOn
public static <R,T> R directlyOn(T shadowedObject, Class<T> clazz, String methodName, ReflectionHelpers.ClassParameter... paramValues)
-
directlyOn
public static <R,T> R directlyOn(Class<T> clazz, String methodName, ReflectionHelpers.ClassParameter... paramValues)
-
invokeConstructor
public static <R> R invokeConstructor(Class<? extends R> clazz, R instance, ReflectionHelpers.ClassParameter... paramValues)
-
directInitialize
public static void directInitialize(Class<?> clazz)
-
-