Config.java revision 6b00d4156e2e6bb2d262458a2650a109ddc76c76
1cfb3d242306311ce27ec51bf511764377c173a7cKiran Ryali + Christian Williamspackage org.robolectric.annotation; 2dd40f718cf785a56e63c0685feeb73d266c13e3fWenhui Yao 39cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrishimport android.app.Application; 4f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport org.jetbrains.annotations.NotNull; 5f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 6f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.Annotation; 7f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.Documented; 8f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.ElementType; 9f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.Retention; 10f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.RetentionPolicy; 11f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.Target; 12f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.util.Arrays; 13c77f5791f081893a18f9db753bb5022269a7c5a6Simon Arlottimport java.util.HashSet; 1423a26cc3e5b33c0503a99847292ac99817f5af43Christian Williamsimport java.util.Properties; 15c77f5791f081893a18f9db753bb5022269a7c5a6Simon Arlottimport java.util.Set; 16f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 17dd40f718cf785a56e63c0685feeb73d266c13e3fWenhui Yao/** 1880c8a1718d42c7e2165289a7bbfab5e7f3dc0513Christian Williams & Dimitris Couchell * Indicate that robolectric should look for values that is specific by those qualifiers 19dd40f718cf785a56e63c0685feeb73d266c13e3fWenhui Yao */ 20f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams@Documented 21f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams@Retention(RetentionPolicy.RUNTIME) 22f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams@Target({ElementType.TYPE, ElementType.METHOD}) 237be4d2ba0e45483ad70cbd994955ae1b70afafdcKiran Ryali + Christian Williamspublic @interface Config { 2429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public static final String NONE = "--none"; 2529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public static final String DEFAULT = "--default"; 266b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public static final String DEFAULT_RES_FOLDER = "res"; 276b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public static final String DEFAULT_ASSET_FOLDER = "assets"; 2829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 2929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 30074a38a2ee8dd8cb1904853aebf2f30146d563a2Mike Grafton * The Android SDK level to emulate. If not specified, Robolectric defaults to API 16. 3129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 32b2a2e594372228d4e4cae61730152d4e1047c8a7Erich Douglass int emulateSdk() default -1; 3329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 3429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 3529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * The Android manifest file to load; Robolectric will look relative to the current directory. 3629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * Resources and assets will be loaded relative to the manifest. 3729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * 3829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * If not specified, Robolectric defaults to {@code AndroidManifest.xml}. 3929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * 4029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * If your project has no manifest or resources, use {@link Config#NONE}. 4129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 4229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams String manifest() default DEFAULT; 4329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 4429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 459cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish * The {@link android.app.Application} class to use in the test, this takes precedence over any application 469cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish * specified in the AndroidManifest.xml. 479cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish */ 489cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish Class<? extends Application> application() default Application.class; 499cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish 509cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish /** 5129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * Qualifiers for the resource resolution, such as "fr-normal-port-hdpi". 5229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * 5329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * @see <a href="http://developer.android.com/guide/topics/resources/providing-resources.html">Providing Resources</a> in the Android Developer docs for more information. 5429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 5529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams String qualifiers() default ""; 5629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 5729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 586b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * The directory from which to load resources. This should be relative to the directory containing AndroidManifest.xml. 596b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * <p> 605277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John * If not specified, Robolectric defaults to {@code res}. 615277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John */ 626b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass String resourceDir() default DEFAULT_RES_FOLDER; 636b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass 646b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass /** 656b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * The directory from which to load assets. This should be relative to the directory containing AndroidManifest.xml. 666b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * <p> 676b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * If not specified, Robolectric defaults to {@code assets}. 686b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass */ 696b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass String assetDir() default DEFAULT_ASSET_FOLDER; 705277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John 715277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John /** 7229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * The Android SDK level to report in Build.VERSION.SDK_INT. 7329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * 7429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * @see <a href="http://en.wikipedia.org/wiki/Android_version_history">Android Version History</a>. 7529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 7629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams int reportSdk() default -1; 7729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 7829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 7929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * A list of shadow classes to enable, in addition to those that are already present. 8029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 8129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Class<?>[] shadows() default {}; 8229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 83ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson /** 84ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson * A list of folders containing Android Libraries on which this project depends. 85ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson */ 86ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson String[] libraries() default {}; 87ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 8829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public class Implementation implements Config { 8929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final int emulateSdk; 9029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final String manifest; 9129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final String qualifiers; 925277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John private final String resourceDir; 936b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass private final String assetDir; 9429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final int reportSdk; 9529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final Class<?>[] shadows; 969cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish private final Class<? extends Application> application; 97ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson private final String[] libraries; 9829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 9929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public static Config fromProperties(Properties configProperties) { 10029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (configProperties == null || configProperties.size() == 0) return null; 10129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return new Implementation( 10229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Integer.parseInt(configProperties.getProperty("emulateSdk", "-1")), 10329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams configProperties.getProperty("manifest", DEFAULT), 10429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams configProperties.getProperty("qualifiers", ""), 1056b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass configProperties.getProperty("resourceDir", Config.DEFAULT_RES_FOLDER), 1066b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass configProperties.getProperty("assetDir", Config.DEFAULT_ASSET_FOLDER), 10729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Integer.parseInt(configProperties.getProperty("reportSdk", "-1")), 1089cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish parseClasses(configProperties.getProperty("shadows", "")), 109ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson parseApplication(configProperties.getProperty("application", "android.app.Application")), 110ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson parsePaths(configProperties.getProperty("libraries", "")) 11129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams ); 11229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 11323a26cc3e5b33c0503a99847292ac99817f5af43Christian Williams 11429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private static Class<?>[] parseClasses(String classList) { 11529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (classList.length() == 0) return new Class[0]; 11629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams String[] classNames = classList.split("[, ]+"); 11729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Class[] classes = new Class[classNames.length]; 11829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams for (int i = 0; i < classNames.length; i++) { 11929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams try { 12029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams classes[i] = Implementation.class.getClassLoader().loadClass(classNames[i]); 12129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } catch (ClassNotFoundException e) { 12229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams throw new RuntimeException(e); 12323a26cc3e5b33c0503a99847292ac99817f5af43Christian Williams } 12429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 12529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return classes; 12629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 12723a26cc3e5b33c0503a99847292ac99817f5af43Christian Williams 1289cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish private static <T extends Application> Class<T> parseApplication(String className) { 1299cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish try { 1309cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish Class<T> aClass = (Class<T>) Implementation.class.getClassLoader().loadClass(className); 1319cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish return aClass; 1329cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish } catch (ClassNotFoundException e) { 1339cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish throw new RuntimeException(e); 1349cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish } 1359cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish } 1369cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish 137ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson private static String[] parsePaths(String pathList) { 138ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson if (pathList.length() == 0) return new String[0]; 139ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson return pathList.split("[, ]+"); 140ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson } 141ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 1426b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public Implementation(int emulateSdk, String manifest, String qualifiers, String resourceDir, String assetDir, int reportSdk, Class<?>[] shadows, Class<? extends Application> application, String[] libraries) { 14329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.emulateSdk = emulateSdk; 14429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.manifest = manifest; 14529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.qualifiers = qualifiers; 1465277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John this.resourceDir = resourceDir; 1476b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass this.assetDir = assetDir; 14829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.reportSdk = reportSdk; 14929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.shadows = shadows; 1509cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish this.application = application; 151ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson this.libraries = libraries; 15229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 153f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 15429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public Implementation(Config baseConfig, Config overlayConfig) { 155b2a2e594372228d4e4cae61730152d4e1047c8a7Erich Douglass this.emulateSdk = pick(baseConfig.emulateSdk(), overlayConfig.emulateSdk(), -1); 15629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.manifest = pick(baseConfig.manifest(), overlayConfig.manifest(), DEFAULT); 15729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.qualifiers = pick(baseConfig.qualifiers(), overlayConfig.qualifiers(), ""); 1586b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass this.resourceDir = pick(baseConfig.resourceDir(), overlayConfig.resourceDir(), Config.DEFAULT_RES_FOLDER); 1596b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass this.assetDir = pick(baseConfig.assetDir(), overlayConfig.assetDir(), Config.DEFAULT_ASSET_FOLDER); 16029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.reportSdk = pick(baseConfig.reportSdk(), overlayConfig.reportSdk(), -1); 161ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 162c77f5791f081893a18f9db753bb5022269a7c5a6Simon Arlott Set<Class<?>> shadows = new HashSet<Class<?>>(); 16329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams shadows.addAll(Arrays.asList(baseConfig.shadows())); 16429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams shadows.addAll(Arrays.asList(overlayConfig.shadows())); 16529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.shadows = shadows.toArray(new Class[shadows.size()]); 166ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 1679cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish this.application = pick(baseConfig.application(), overlayConfig.application(), null); 168ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 169ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson Set<String> libraries = new HashSet<String>(); 170ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson libraries.addAll(Arrays.asList(baseConfig.libraries())); 171ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson libraries.addAll(Arrays.asList(overlayConfig.libraries())); 172ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson this.libraries = libraries.toArray(new String[libraries.size()]); 17329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 174f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 17529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private <T> T pick(T baseValue, T overlayValue, T nullValue) { 17629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return overlayValue.equals(nullValue) ? baseValue : overlayValue; 17729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 178f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 1796b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 1806b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public int emulateSdk() { 18129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return emulateSdk; 18229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 183f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 1846b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 1856b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public String manifest() { 18629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return manifest; 18729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 18848f95f3e0955035946f7c416dec56219a9b19886Christian Williams 1899cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish @Override 1909cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish public Class<? extends Application> application() { 1919cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish return application; 1929cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish } 1939cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish 1946b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 1956b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public String qualifiers() { 19629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return qualifiers; 19729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 198f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 1995277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John @Override 2005277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John public String resourceDir() { 2015277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John return resourceDir; 2025277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John } 2035277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John 2046b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2056b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public String assetDir() { 2066b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass return assetDir; 2076b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass } 2086b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass 2096b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2106b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public int reportSdk() { 21129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return reportSdk; 21229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 213f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 2146b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2156b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public Class<?>[] shadows() { 21629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return shadows; 21729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 218f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 2196b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2206b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public String[] libraries() { 221ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson return libraries; 222ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson } 223ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 2246b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @NotNull @Override 2256b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public Class<? extends Annotation> annotationType() { 22629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return Config.class; 22729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 228f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 22929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams @Override 23029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public boolean equals(Object o) { 23129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (this == o) return true; 23229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (o == null || getClass() != o.getClass()) return false; 233f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 23429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Implementation other = (Implementation) o; 235f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 23629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (emulateSdk != other.emulateSdk) return false; 23729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (reportSdk != other.reportSdk) return false; 23829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (!qualifiers.equals(other.qualifiers)) return false; 23929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (!Arrays.equals(shadows, other.shadows)) return false; 2409cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish if (application != other.application) return false; 241f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 24229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return true; 24329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 244f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 24529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams @Override 24629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public int hashCode() { 24729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams int result = emulateSdk; 24829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams result = 31 * result + qualifiers.hashCode(); 24929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams result = 31 * result + reportSdk; 25029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams result = 31 * result + Arrays.hashCode(shadows); 2519cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish result = 31 * result + application.hashCode(); 25229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return result; 253f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams } 25429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 255dd40f718cf785a56e63c0685feeb73d266c13e3fWenhui Yao} 256