com.volcengine.util.ConvertUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of volc-sdk-java Show documentation
Show all versions of volc-sdk-java Show documentation
The VOLC Engine SDK for Java
package com.volcengine.util;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
public class ConvertUtils {
public static List convertToPair(Object obj) throws Exception {
List urlValues = new ArrayList<>();
Field[] fields = obj.getClass().getDeclaredFields();
for (Field field: fields){
field.setAccessible(true);
if (field.get(obj) == null){
continue;
}
urlValues.add(new BasicNameValuePair(field.getName(), field.get(obj).toString()));
}
return urlValues;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy