Jackson 2.1.0 を使用しています。与えられた:
public static final class GetCompanies
{
private final List<URI> companies;
/**
* Creates a new GetCompanies.
* <p/>
* @param companies the list of available companies
* @throws NullPointerException if companies is null
*/
@JsonCreator
public GetCompanies(@JsonUnwrapped @NotNull List<URI> companies)
{
Preconditions.checkNotNull(companies, "companies");
this.companies = ImmutableList.copyOf(companies);
}
/**
* @return the list of available companies
*/
@JsonUnwrapped
@SuppressWarnings("ReturnOfCollectionOrArrayField")
public List<URI> getCompanies()
{
return companies;
}
}
入力リストに が含まれている場合http://test.com/
、Jackson は以下を生成します。
{"companies":["http://test.com/"]}
それ以外の:
["http://test.com/"]
何か案は?
更新:関連する議論については、https ://github.com/FasterXML/jackson-core/issues/41 を参照してください。