// 通常使用 -> this is a for b
format("this is {} for {}", "a", "b")
// 转义{}:-> this is \{} for a
format("this is \\{} for {}", "a", "b")
// 转义\::-> this is \a for b
format("this is \\\\{} for {}", "a", "b")
public class IotResponse<T>
private T data;
public class IotPageResponse<T>
private List<T> list;
public class IotCardInfoResponse
使用方式:
Function<ObjectMapper, JavaType> f = om -> {
TypeFactory factory = om.getTypeFactory();
JavaType pageType = factory.constructParametricType(IotPageResponse.class, IotCardInfoResponse.class);
return factory.constructParametricType(IotResponse.class, pageType);
};
IotResponse<IotPageResponse<IotCardInfoResponse>> response = JsonUtil.toPojo(json, f);
Copyright © 2024. All rights reserved.