@Test public void testRightCoderForInheritedBasicSupportedType() throws CoderNotFoundException { StateCoder coder = StateCoderUtils.getBasicCoderForClass(String.class); assertEquals(StringCoder.class, coder.getClass()); }
@NonNull public static StateCoder getBasicCoderForClass(@NonNull Class<?> cls) throws CoderNotFoundException { if (boolean.class == cls || Boolean.class == cls) return new BooleanCoder(); if (boolean[].class == cls) return new BooleanArrayCoder(); if (byte.class == cls || Byte.class == cls) return new ByteCoder(); if (byte[].class == cls) return new ByteArrayCoder(); if (char.class == cls || Character.class == cls) return new CharCoder(); if (char[].class == cls) return new CharArrayCoder(); if (CharSequence.class == cls) return new CharSequenceCoder(); if (CharSequence[].class == cls) return new CharSequenceArrayCoder(); if (double.class == cls || Double.class == cls) return new DoubleCoder(); if (double[].class == cls) return new DoubleArrayCoder(); if (float.class == cls || Float.class == cls) return new FloatCoder(); if (float[].class == cls) return new FloatArrayCoder(); if (IBinder.class == cls) return new IBinderCoder(); if (int.class == cls || Integer.class == cls) return new IntCoder(); if (int[].class == cls) return new IntArrayCoder(); if (long.class == cls || Long.class == cls) return new LongCoder(); if (long[].class == cls) return new LongArrayCoder(); if (Parcelable.class == cls) return new ParcelableCoder(); if (Parcelable[].class == cls) return new ParcelableArrayCoder(); if (Serializable.class == cls) return new SerializableCoder(); if (short.class == cls || Short.class == cls) return new ShortCoder(); if (short[].class == cls) return new ShortArrayCoder(); if (String.class == cls) return new StringCoder(); if (String[].class == cls) return new StringArrayCoder(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Size.class == cls) return new SizeCoder(); if (SizeF.class == cls) return new SizeFCoder(); } return getBasicCoderForInheritedClass(cls); }
StateCoderUtils { @NonNull public static StateCoder getBasicCoderForClass(@NonNull Class<?> cls) throws CoderNotFoundException { if (boolean.class == cls || Boolean.class == cls) return new BooleanCoder(); if (boolean[].class == cls) return new BooleanArrayCoder(); if (byte.class == cls || Byte.class == cls) return new ByteCoder(); if (byte[].class == cls) return new ByteArrayCoder(); if (char.class == cls || Character.class == cls) return new CharCoder(); if (char[].class == cls) return new CharArrayCoder(); if (CharSequence.class == cls) return new CharSequenceCoder(); if (CharSequence[].class == cls) return new CharSequenceArrayCoder(); if (double.class == cls || Double.class == cls) return new DoubleCoder(); if (double[].class == cls) return new DoubleArrayCoder(); if (float.class == cls || Float.class == cls) return new FloatCoder(); if (float[].class == cls) return new FloatArrayCoder(); if (IBinder.class == cls) return new IBinderCoder(); if (int.class == cls || Integer.class == cls) return new IntCoder(); if (int[].class == cls) return new IntArrayCoder(); if (long.class == cls || Long.class == cls) return new LongCoder(); if (long[].class == cls) return new LongArrayCoder(); if (Parcelable.class == cls) return new ParcelableCoder(); if (Parcelable[].class == cls) return new ParcelableArrayCoder(); if (Serializable.class == cls) return new SerializableCoder(); if (short.class == cls || Short.class == cls) return new ShortCoder(); if (short[].class == cls) return new ShortArrayCoder(); if (String.class == cls) return new StringCoder(); if (String[].class == cls) return new StringArrayCoder(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Size.class == cls) return new SizeCoder(); if (SizeF.class == cls) return new SizeFCoder(); } return getBasicCoderForInheritedClass(cls); } }
StateCoderUtils { @NonNull public static StateCoder getBasicCoderForClass(@NonNull Class<?> cls) throws CoderNotFoundException { if (boolean.class == cls || Boolean.class == cls) return new BooleanCoder(); if (boolean[].class == cls) return new BooleanArrayCoder(); if (byte.class == cls || Byte.class == cls) return new ByteCoder(); if (byte[].class == cls) return new ByteArrayCoder(); if (char.class == cls || Character.class == cls) return new CharCoder(); if (char[].class == cls) return new CharArrayCoder(); if (CharSequence.class == cls) return new CharSequenceCoder(); if (CharSequence[].class == cls) return new CharSequenceArrayCoder(); if (double.class == cls || Double.class == cls) return new DoubleCoder(); if (double[].class == cls) return new DoubleArrayCoder(); if (float.class == cls || Float.class == cls) return new FloatCoder(); if (float[].class == cls) return new FloatArrayCoder(); if (IBinder.class == cls) return new IBinderCoder(); if (int.class == cls || Integer.class == cls) return new IntCoder(); if (int[].class == cls) return new IntArrayCoder(); if (long.class == cls || Long.class == cls) return new LongCoder(); if (long[].class == cls) return new LongArrayCoder(); if (Parcelable.class == cls) return new ParcelableCoder(); if (Parcelable[].class == cls) return new ParcelableArrayCoder(); if (Serializable.class == cls) return new SerializableCoder(); if (short.class == cls || Short.class == cls) return new ShortCoder(); if (short[].class == cls) return new ShortArrayCoder(); if (String.class == cls) return new StringCoder(); if (String[].class == cls) return new StringArrayCoder(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Size.class == cls) return new SizeCoder(); if (SizeF.class == cls) return new SizeFCoder(); } return getBasicCoderForInheritedClass(cls); } private  StateCoderUtils(); }
StateCoderUtils { @NonNull public static StateCoder getBasicCoderForClass(@NonNull Class<?> cls) throws CoderNotFoundException { if (boolean.class == cls || Boolean.class == cls) return new BooleanCoder(); if (boolean[].class == cls) return new BooleanArrayCoder(); if (byte.class == cls || Byte.class == cls) return new ByteCoder(); if (byte[].class == cls) return new ByteArrayCoder(); if (char.class == cls || Character.class == cls) return new CharCoder(); if (char[].class == cls) return new CharArrayCoder(); if (CharSequence.class == cls) return new CharSequenceCoder(); if (CharSequence[].class == cls) return new CharSequenceArrayCoder(); if (double.class == cls || Double.class == cls) return new DoubleCoder(); if (double[].class == cls) return new DoubleArrayCoder(); if (float.class == cls || Float.class == cls) return new FloatCoder(); if (float[].class == cls) return new FloatArrayCoder(); if (IBinder.class == cls) return new IBinderCoder(); if (int.class == cls || Integer.class == cls) return new IntCoder(); if (int[].class == cls) return new IntArrayCoder(); if (long.class == cls || Long.class == cls) return new LongCoder(); if (long[].class == cls) return new LongArrayCoder(); if (Parcelable.class == cls) return new ParcelableCoder(); if (Parcelable[].class == cls) return new ParcelableArrayCoder(); if (Serializable.class == cls) return new SerializableCoder(); if (short.class == cls || Short.class == cls) return new ShortCoder(); if (short[].class == cls) return new ShortArrayCoder(); if (String.class == cls) return new StringCoder(); if (String[].class == cls) return new StringArrayCoder(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Size.class == cls) return new SizeCoder(); if (SizeF.class == cls) return new SizeFCoder(); } return getBasicCoderForInheritedClass(cls); } private  StateCoderUtils(); @NonNull static StateCoder getBasicCoderForClass(@NonNull Class<?> cls); }
StateCoderUtils { @NonNull public static StateCoder getBasicCoderForClass(@NonNull Class<?> cls) throws CoderNotFoundException { if (boolean.class == cls || Boolean.class == cls) return new BooleanCoder(); if (boolean[].class == cls) return new BooleanArrayCoder(); if (byte.class == cls || Byte.class == cls) return new ByteCoder(); if (byte[].class == cls) return new ByteArrayCoder(); if (char.class == cls || Character.class == cls) return new CharCoder(); if (char[].class == cls) return new CharArrayCoder(); if (CharSequence.class == cls) return new CharSequenceCoder(); if (CharSequence[].class == cls) return new CharSequenceArrayCoder(); if (double.class == cls || Double.class == cls) return new DoubleCoder(); if (double[].class == cls) return new DoubleArrayCoder(); if (float.class == cls || Float.class == cls) return new FloatCoder(); if (float[].class == cls) return new FloatArrayCoder(); if (IBinder.class == cls) return new IBinderCoder(); if (int.class == cls || Integer.class == cls) return new IntCoder(); if (int[].class == cls) return new IntArrayCoder(); if (long.class == cls || Long.class == cls) return new LongCoder(); if (long[].class == cls) return new LongArrayCoder(); if (Parcelable.class == cls) return new ParcelableCoder(); if (Parcelable[].class == cls) return new ParcelableArrayCoder(); if (Serializable.class == cls) return new SerializableCoder(); if (short.class == cls || Short.class == cls) return new ShortCoder(); if (short[].class == cls) return new ShortArrayCoder(); if (String.class == cls) return new StringCoder(); if (String[].class == cls) return new StringArrayCoder(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Size.class == cls) return new SizeCoder(); if (SizeF.class == cls) return new SizeFCoder(); } return getBasicCoderForInheritedClass(cls); } private  StateCoderUtils(); @NonNull static StateCoder getBasicCoderForClass(@NonNull Class<?> cls);  }