Home | History | Annotate | Download | only in annotation
      1 package org.robolectric.annotation;
      2 
      3 import java.lang.annotation.Documented;
      4 import java.lang.annotation.ElementType;
      5 import java.lang.annotation.Retention;
      6 import java.lang.annotation.RetentionPolicy;
      7 import java.lang.annotation.Target;
      8 
      9 /**
     10  * Indicates that a class declaration is intended to shadow an Android class declaration.
     11  * The Robolectric runtime searches classes with this annotation for methods with the
     12  * {@link Implementation} annotation and calls them in place of the methods on the Android
     13  * class.
     14  */
     15 @Documented
     16 @Retention(RetentionPolicy.RUNTIME)
     17 @Target({ElementType.TYPE})
     18 public @interface Implements {
     19 
     20   /**
     21    * The Android class to be shadowed.
     22    *
     23    * @return Android class to shadow.
     24    */
     25   Class<?> value() default void.class;
     26 
     27   /**
     28    * Android class name (if the Class object is not accessible).
     29    *
     30    * @return Android class name.
     31    */
     32   String className() default "";
     33 
     34   /**
     35    * Denotes that this type exists in the public Android SDK. When this value is true, the
     36    * annotation processor will generate a shadowOf method.
     37    *
     38    * @return True if the type is exposed in the Android SDK.
     39    */
     40   boolean isInAndroidSdk() default true;
     41 
     42   /**
     43    * If true, Robolectric will invoke the actual Android code for any method that isn't shadowed.
     44    *
     45    * @return True to invoke the underlying method.
     46    */
     47   boolean callThroughByDefault() default true;
     48 
     49   /**
     50    * If true, Robolectric will invoke @Implementation methods from superclasses.
     51    *
     52    * @return True to invoke superclass methods.
     53    */
     54   boolean inheritImplementationMethods() default false;
     55 
     56   /**
     57    * If true, when an exact method signature match isn't found, Robolectric will look for a method
     58    * with the same name but with all argument types replaced with java.lang.Object.
     59    *
     60    * @return True to disable strict signature matching.
     61    */
     62   boolean looseSignatures() default false;
     63 
     64   /**
     65    * If specified, the shadow class will be applied only for this SDK or greater.
     66    */
     67   int minSdk() default -1;
     68 
     69   /**
     70    * If specified, the shadow class will be applied only for this SDK or lesser.
     71    */
     72   int maxSdk() default -1;
     73 }
     74