Home | History | Annotate | Download | only in test
      1 package test;
      2 
      3 import dagger.Module;
      4 import dagger.Provides;
      5 
      6 @Module
      7 final class PrimitivesModule {
      8   static final byte BOUND_BYTE = -41;
      9   static final char BOUND_CHAR = 'g';
     10   static final short BOUND_SHORT = 21840;
     11   static final int BOUND_INT = 1894833693;
     12   static final long BOUND_LONG = -4369839828653523584L;
     13   static final boolean BOUND_BOOLEAN = true;
     14   static final float BOUND_FLOAT = (float) 0.9964542;
     15   static final double BOUND_DOUBLE = 0.12681322049667765;
     16 
     17   /*
     18    * While we can't ensure that these constants stay constant, this is a test so we're just going to
     19    * keep our fingers crossed that we're not going to be jerks.
     20    */
     21   static final byte[] BOUND_BYTE_ARRAY =  {1, 2, 3};
     22   static final char[] BOUND_CHAR_ARRAY = {'g', 'a', 'k'};
     23   static final short[] BOUND_SHORT_ARRAY = {2, 4};
     24   static final int[] BOUND_INT_ARRAY = {3, 1, 2};
     25   static final long[] BOUND_LONG_ARRAY = {1, 1, 2, 3, 5};
     26   static final boolean[] BOUND_BOOLEAN_ARRAY = {false, true, false, false};
     27   static final float[] BOUND_FLOAT_ARRAY = {(float) 0.1, (float) 0.01, (float) 0.001};
     28   static final double[] BOUND_DOUBLE_ARRAY = {0.2, 0.02, 0.002};
     29 
     30   @Provides static byte provideByte() {
     31     return BOUND_BYTE;
     32   }
     33 
     34   @Provides static char provideChar() {
     35     return BOUND_CHAR;
     36   }
     37 
     38   @Provides static short provideShort() {
     39     return BOUND_SHORT;
     40   }
     41 
     42   @Provides static int provideInt() {
     43     return BOUND_INT;
     44   }
     45 
     46   @Provides static long provideLong() {
     47     return BOUND_LONG;
     48   }
     49 
     50   @Provides static boolean provideBoolean() {
     51     return BOUND_BOOLEAN;
     52   }
     53 
     54   @Provides static float provideFloat() {
     55     return BOUND_FLOAT;
     56   }
     57 
     58   @Provides static double boundDouble() {
     59     return BOUND_DOUBLE;
     60   }
     61 
     62   @Provides static byte[] provideByteArray() {
     63     return BOUND_BYTE_ARRAY;
     64   }
     65 
     66   @Provides static char[] provideCharArray() {
     67     return BOUND_CHAR_ARRAY;
     68   }
     69 
     70   @Provides static short[] provideShortArray() {
     71     return BOUND_SHORT_ARRAY;
     72   }
     73 
     74   @Provides static int[] provideIntArray() {
     75     return BOUND_INT_ARRAY;
     76   }
     77 
     78   @Provides static long[] provideLongArray() {
     79     return BOUND_LONG_ARRAY;
     80   }
     81 
     82   @Provides static boolean[] provideBooleanArray() {
     83     return BOUND_BOOLEAN_ARRAY;
     84   }
     85 
     86   @Provides static float[] provideFloatArray() {
     87     return BOUND_FLOAT_ARRAY;
     88   }
     89 
     90   @Provides static double[] boundDoubleArray() {
     91     return BOUND_DOUBLE_ARRAY;
     92   }
     93 }
     94