Olá galera, estou utilizando o xstream para para xml’s para uma lista de objetos em java. Porém, apesar de estar tudo correto, conforme vários tutorias que vi na internet, estou tendo alguns problemas para fazer o que desejo.
O xml é da seguinte maneira:
<template.Matrizes>
<Matriz>
<NOME>Teste1</NOME>
<CODIGO>1</CODIGO>
</Matriz>
<Matriz>
<NOME>Teste2</NOME>
<CODIGO>2</CODIGO>
</Matriz>
</template.Matrizes>
e minhas classes para fazer a serialização são:
[code]package template;
import java.util.ArrayList;
import java.util.List;
public class Matrizes {
public List<Matriz> Matriz;
public Matrizes(){
Matriz = new ArrayList<Matriz>();
}
public void add(Matriz p){
Matriz.add(p);
}
} [/code]
[code]package template;
public class Matriz {
String NOME;
int CODIGO;
public String getNome() {
return NOME;
}
public void setNome(String nome) {
this.NOME = nome;
}
public int getCodigo() {
return CODIGO;
}
public void setCodigo(int codigo) {
this.CODIGO = codigo;
}
} [/code]
chamo a conversao da seguinte maneira:
Apesar de correto, acho, da o seguinte erro:
Exception in thread “main” com.thoughtworks.xstream.converters.ConversionException: NOME : NOME
---- Debugging information ----
message : NOME
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : NOME
class : java.util.ArrayList
required-type : java.util.ArrayList
converter-type : com.thoughtworks.xstream.converters.collections.CollectionConverter
path : /template.Matrizes/Matriz/NOME
line number : 1
class[1] : template.Matrizes
converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
version : null
o que será que pode ser?