Com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter $ DuplicateFieldException: Duplicate Field

field               : param
class               : xmleditor.domain.Type
required-type       : xmleditor.domain.Type
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path                : /root/type/param[2]

I get this error to get a duplicate of Param. But when I try to use

xstream.addImplicitCollection

I get this error:

Exception in thread "main" com.thoughtworks.xstream.InitializationException: Field "param" declares no collection or array.

So I don’t know what my problem is.

 @XStreamAlias("root")
    public class Type {

        private Info info;
        @XStreamAlias("OBJECT_TYPE")
        private String objectType;
        private Properties prop;
        private Parameters param;
        private Restrictions restri;

        @XStreamImplicit(itemFieldName = "type")
        private List typeList = new ArrayList();
// Constructor, Getters and setters.

What could be causing this problem?

+4
source share
1 answer

Declaring an implicit collection means that you have multiple xml elements with the same tag name at the same nesting level in your XML document.

Java-, . XStream .

, param Collection Array. ,

private Parameters param;

@XStreamImplicit
private List<Parameters> param;
+3

Source: https://habr.com/ru/post/1523323/


All Articles