类 JsonUtils
java.lang.Object
com.infilake.openapi.bidding.parser.JsonUtils
JSON utility class using Jackson for robust JSON processing
Provides methods to convert JSON to typed Java objects using Jackson ObjectMapper.
Supports nested objects, generic types, and comprehensive error handling.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static com.fasterxml.jackson.databind.ObjectMapperGet the shared ObjectMapper instancestatic <T> ApiResult<T>parseToApiResult(String json, Class<T> dataClass) Parse JSON string to ApiResult with single data typeparseToApiResultList(String json, Class<T> itemClass) Parse JSON string to ApiResult with List data typestatic <T> ApiResult<PageResult<T>>parseToPageResult(String json, Class<T> recordClass) Parse JSON string to ApiResult with PageResultstatic StringtoJsonString(Object obj) Convert Java object to JSON string
-
构造器详细资料
-
JsonUtils
public JsonUtils()
-
-
方法详细资料
-
getObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()Get the shared ObjectMapper instance -
parseToApiResult
Parse JSON string to ApiResult with single data type- 类型参数:
T- Type of data- 参数:
json- JSON stringdataClass- Class of data object- 返回:
- ApiResult containing the data
-
parseToApiResultList
Parse JSON string to ApiResult with List data type- 类型参数:
T- Type of items- 参数:
json- JSON stringitemClass- Class of items in the list- 返回:
- ApiResult containing List of items
-
parseToPageResult
Parse JSON string to ApiResult with PageResult- 类型参数:
T- Type of records- 参数:
json- JSON stringrecordClass- Class of records in the page- 返回:
- ApiResult containing PageResult
-
toJsonString
Convert Java object to JSON string- 参数:
obj- The object to convert- 返回:
- JSON string representation
-