开发者

has anyone got xmlbeans to work with GSON?

开发者 https://www.devze.com 2023-01-20 13:49 出处:网络
Basically as above. Gson gson = new Gson(); ErrorsDocument er = ErrorsDocument.Factory.newInstance(); er.setError(\"monkey escaped\");

Basically as above.

Gson gson = new Gson();
ErrorsDocument er = ErrorsDocument.Factory.newInstance();
er.setError("monkey escaped");
System.out.println(gson.toJson(er));

cra开发者_高级运维ps out with:

Exception in thread "main" java.lang.IllegalStateException: How can the type variable not be present in the class declaration! at com.google.gson.TypeInfoFactory.getIndex(TypeInfoFactory.java:127) at com.google.gson.TypeInfoFactory.getActualType(TypeInfoFactory.java:93) at com.google.gson.TypeInfoFactory.getTypeInfoForField(TypeInfoFactory.java:54)

etc

0

精彩评论

暂无评论...
验证码 换一张
取 消