Salve senhores,
Estou usando XStream para gerar o XML de algumas classes, em uma delas existe um attributo com o tipo array de byte, não quero que este atributo seja gerado no xml. Na documentação do XStream diz que posso utilizar tanto um Annotation quanto uma linha de comando, porém nenhum dos dois estão funcionando =(
XStream xstream = new XStream( new DomDriver() );
xstream.omitField(Byte[].class, "foto");
String xmlSistemas = xstream.toXML(sistemas);
package br.com.habibs.cadastrobasico.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import org.spicefactory.pimento.config.Managed;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
/**
* @author renan.barbioni
*
*/
@NamedQuery(name = "findAllSistemas", query = "from Sistema")
@Entity
@Table(schema = "ACESSO")
@Managed
public class Sistema extends Model implements Image {
private static final long serialVersionUID = 1L;
private String descricao;
private String link;
private String sigla;
@Column(name = "IMAGEM")
@XStreamOmitField
private Byte[] foto;
private String texto;
@Column(name = "DESENVOLVIDO_POR")
private String desenvolvidoPor;
@Column(name = "FLAG_BLOQUEADO")
private Boolean bloqueado;
/**
* @return the descricao
*/
public String getDescricao() {
return descricao;
}
/**
* @param descricao
* the descricao to set
*/
public void setDescricao(String descricao) {
this.descricao = descricao;
}
/**
* @return the link
*/
public String getLink() {
return link;
}
/**
* @param link
* the link to set
*/
public void setLink(String link) {
this.link = link;
}
/**
* @return the sigla
*/
public String getSigla() {
return sigla;
}
/**
* @param sigla
* the sigla to set
*/
public void setSigla(String sigla) {
this.sigla = sigla;
}
/**
* @return the foto
*/
public Byte[] getFoto() {
return foto;
}
/**
* @param foto
* the foto to set
*/
public void setFoto(Byte[] foto) {
this.foto = foto;
}
/**
* @return the texto
*/
public String getTexto() {
return texto;
}
/**
* @param texto
* the texto to set
*/
public void setTexto(String texto) {
this.texto = texto;
}
/**
* @return the desenvolvidoPor
*/
public String getDesenvolvidoPor() {
return desenvolvidoPor;
}
/**
* @param desenvolvidoPor
* the desenvolvidoPor to set
*/
public void setDesenvolvidoPor(String desenvolvidoPor) {
this.desenvolvidoPor = desenvolvidoPor;
}
/**
* @return the bloqueado
*/
public Boolean getBloqueado() {
return bloqueado;
}
/**
* @param bloqueado
* the bloqueado to set
*/
public void setBloqueado(Boolean bloqueado) {
this.bloqueado = bloqueado;
}
}
Alguém faz idéia do que possa ser? Estou usando a versão 1.3.1 do XStream…
Obrigado!