类 DefaultFormConvertor

java.lang.Object
com.dtflys.forest.converter.form.DefaultFormConvertor
所有已实现的接口:
ForestConverter<String>, ForestEncoder

public class DefaultFormConvertor extends Object implements ForestConverter<String>, ForestEncoder
  • 构造器详细资料

  • 方法详细资料

    • convertToJavaObject

      public <T> T convertToJavaObject(String source, Type targetType)
      从接口复制的说明: ForestConverter
      将源数据转换为目标类型(Type)的java对象
      指定者:
      convertToJavaObject 在接口中 ForestConverter<String>
      类型参数:
      T - 目标类型泛型
      参数:
      source - 源数据
      targetType - 目标类型 (Type对象)
      返回:
      转换后的目标类型对象
    • convertToJavaObject

      public <T> T convertToJavaObject(byte[] source, Class<T> targetType, Charset charset)
      从接口复制的说明: ForestConverter
      将源数据转换为目标类型(Class)的java对象
      指定者:
      convertToJavaObject 在接口中 ForestConverter<String>
      类型参数:
      T - 目标类型泛型
      参数:
      source - 源数据
      targetType - 目标类型 (Class对象)
      charset - 字符集
      返回:
      转换后的目标类型对象
    • convertToJavaObject

      public <T> T convertToJavaObject(byte[] source, Type targetType, Charset charset)
      从接口复制的说明: ForestConverter
      将源数据转换为目标类型(Type)的java对象
      指定者:
      convertToJavaObject 在接口中 ForestConverter<String>
      类型参数:
      T - 目标类型泛型
      参数:
      source - 源数据
      targetType - 目标类型 (Type对象)
      charset - 字符集
      返回:
      转换后的目标类型对象
    • getDataType

      public ForestDataType getDataType()
      从接口复制的说明: ForestConverter
      获取当前数据转换器转换类型
      指定者:
      getDataType 在接口中 ForestConverter<String>
      返回:
      ForestDataType 对象实例
    • encodeToString

      public String encodeToString(Object obj)
      指定者:
      encodeToString 在接口中 ForestEncoder
    • processFormCollectionItem

      protected void processFormCollectionItem(List<RequestNameValue> newNameValueList, ForestConfiguration configuration, String name, Collection collection, int target)
      处理Form表单中的集合项
      参数:
      newNameValueList - 键值对列表
      configuration - Forest配置
      name - 表单项目名
      collection - 集合对象
      target - 请求目标位置
    • processFormArrayItem

      protected void processFormArrayItem(List<RequestNameValue> newNameValueList, ForestConfiguration configuration, String name, Object array, int target)
      处理Form表单中的数组项
      参数:
      newNameValueList - 键值对列表
      configuration - Forest配置
      name - 表单项目名
      array - 数组
      target - 请求目标位置
    • processFormMapItem

      protected void processFormMapItem(List<RequestNameValue> newNameValueList, ForestConfiguration configuration, String name, Map map, int target)
      处理Form表单中的Map项
      参数:
      newNameValueList - 键值对列表
      configuration - Forest配置
      name - 表单项目名
      map - Map对象
      target - 请求目标位置
    • processFormItem

      protected void processFormItem(List<RequestNameValue> newNameValueList, ForestConfiguration configuration, String name, Object value, int target)
      处理Form表单中的项
      参数:
      newNameValueList - 键值对列表
      configuration - Forest配置
      name - 表单项目名
      value - 表单项目值
      target - 请求目标位置
    • processFromNameValueList

      protected List<RequestNameValue> processFromNameValueList(ForestRequest request, List<RequestNameValue> nameValueList, ForestConfiguration configuration, ConvertOptions options)
      处理Form表单中的键值对列表
      参数:
      request - 请求对象
      nameValueList - 键值对列表
      configuration - Forest 配置对象
      options - 转换选项
      返回:
      处理过的新键值对列表
    • encodeRequestBody

      public byte[] encodeRequestBody(ForestBody body, Charset charset, ConvertOptions options)
      指定者:
      encodeRequestBody 在接口中 ForestEncoder