Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ApiService {
- @POST("/api/v1/smart/status")
- Call<SessionStatusResponse> postWorkChangeStatus(@Body WorkChangeStatusRequestData sessionStatusData);
- @POST("/api/v1/smart/sensor")
- Call<SensorDataResponse> postWorkSensorData(@Body SensorRequestData sensorData);
- @GET("/api/v1/smart/sensor")
- @FormUrlEncoded
- Call<AuthConfirmPhoneResponse> getWorkSensorData(@Field("number") String id);
- }
- void parse() {
- methods = clazz.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].isAnnotationPresent(POST.class))
- annotationValues.put(methods[i].getAnnotation(POST.class).value(), new ArrayList<String>());
- else if (methods[i].isAnnotationPresent(GET.class))
- annotationValues.put(methods[i].getAnnotation(GET.class).value(), new ArrayList<String>());
- else if (methods[i].isAnnotationPresent(DELETE.class))
- annotationValues.put(methods[i].getAnnotation(DELETE.class).value(), new ArrayList<String>());
- else if (methods[i].isAnnotationPresent(PUT.class))
- annotationValues.put(methods[i].getAnnotation(PUT.class).value(), new ArrayList<String>());
- else if (methods[i].isAnnotationPresent(HEAD.class))
- annotationValues.put(methods[i].getAnnotation(HEAD.class).value(), new ArrayList<String>());
- else if (methods[i].isAnnotationPresent(OPTIONS.class))
- annotationValues.put(methods[i].getAnnotation(OPTIONS.class).value(), new ArrayList<String>());
- }
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].isAnnotationPresent(POST.class)) {
- // parse(methods[i], POST.class);
- String path = methods[i].getAnnotation(POST.class).value();
- annotationValues.get(path).add(POST.class.getSimpleName());
- } else if (methods[i].isAnnotationPresent(GET.class)) {
- String path = methods[i].getAnnotation(GET.class).value();
- annotationValues.get(path).add(GET.class.getSimpleName());
- } else if (methods[i].isAnnotationPresent(DELETE.class)) {
- String path = methods[i].getAnnotation(DELETE.class).value();
- annotationValues.get(path).add(DELETE.class.getSimpleName());
- } else if (methods[i].isAnnotationPresent(PUT.class)) {
- String path = methods[i].getAnnotation(PUT.class).value();
- annotationValues.get(path).add(PUT.class.getSimpleName());
- } else if (methods[i].isAnnotationPresent(HEAD.class)) {
- String path = methods[i].getAnnotation(HEAD.class).value();
- annotationValues.get(path).add(HEAD.class.getSimpleName());
- } else if (methods[i].isAnnotationPresent(OPTIONS.class)) {
- String path = methods[i].getAnnotation(OPTIONS.class).value();
- annotationValues.get(path).add(OPTIONS.class.getSimpleName());
- }
- }
- }
- private <T extends Annotation> void parse(Method method, Class<T> postClass) {
- String test = ((T)method.getAnnotation(postClass)).value(); //ошибка!
- Log.d(logTag, "========TESTVALUE: " + test);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement