aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/pina/factory/VideoSearchResultConverterFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/pina/factory/VideoSearchResultConverterFactory.java')
-rw-r--r--src/main/java/com/pina/factory/VideoSearchResultConverterFactory.java51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/main/java/com/pina/factory/VideoSearchResultConverterFactory.java b/src/main/java/com/pina/factory/VideoSearchResultConverterFactory.java
deleted file mode 100644
index de47303..0000000
--- a/src/main/java/com/pina/factory/VideoSearchResultConverterFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.pina.factory;
-
-import com.pina.datatypes.Paginated;
-import com.pina.datatypes.SimpleVideo;
-import com.pina.datatypes.VideoSearchResult;
-import okhttp3.ResponseBody;
-import retrofit2.Converter;
-import retrofit2.Retrofit;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.List;
-
-public class VideoSearchResultConverterFactory extends Converter.Factory {
-
- public static VideoSearchResultConverterFactory create() {
- return new VideoSearchResultConverterFactory();
- }
-
- @Override
- public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
- boolean isPaginated = false;
- for (Annotation annotation : annotations) {
- if (annotation instanceof Paginated) {
- isPaginated = ((Paginated) annotation).value();
- }
- }
- if (isPaginated) {
- Type listType = new ParameterizedType() {
- @Override
- public Type[] getActualTypeArguments() {
- return new Type[]{VideoSearchResult.class};
- }
-
- @Override
- public Type getRawType() {
- return List.class;
- }
-
- @Override
- public Type getOwnerType() {
- return null;
- }
- };
- return retrofit.nextResponseBodyConverter(this, listType, annotations);
- } else {
- return retrofit.nextResponseBodyConverter(this, SimpleVideo.class, annotations);
- }
- }
-}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage