You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Victor Rodríguez García <vr...@seidor.es> on 2013/04/04 13:06:56 UTC

RV: [betwixt] Reading a class containing a list of interfaces which implementation is a enum

Hello,

Im trying to parse the following xml to bean list:

<?xml version='1.0' ?>
<ArrayList>
<Padre>
<EnumImpl declaringClass="es.sbs.test.EnumImpl" descripcion="Yes"/>
</Padre>
<Padre>
<EnumImpl declaringClass="es.sbs.test.EnumImpl" descripcion="No"/>
</Padre>
<Padre>
<EnumImpl declaringClass="es.sbs.test.EnumImpl" descripcion="Yes"/>
</Padre>
</ArrayList>

Now this is Padre class:

public class Padre {

    IEnum hijo;

    public IEnum getHijo() {
        return this.hijo;
    }

    public void setHijo(final IEnum hijo) {
        this.hijo = hijo;
    }
}

The attribute “hijo“ is an enum which implements IEnum interface. So EnumImpl is a java enum.
Problema comes when i try to parse this xml to a bean list.

[main] DEBUG org.apache.commons.betwixt.io.BeanReader  - Create new instance failed: java.lang.InstantiationException: es.sbs.test.EnumImpl

It cant instance a java enum of course. Which will be the best way to do this? There is any way out there?
Tried in some ways but didnt have any luck.


Thks in advance for any help.



Victor Rodríguez García
http://www.seidor.es
        [cid:image2e3b19.JPG@401d507f.41a607a0]

Tel:    +34 902 995 374
        5ª Avda., Parcela E-18 - Pol. Pocomaco
15190 A Coruña
España

 [cid:imagee243f2.GIF@73422227.45a1dd32]        Antes de imprimir este mensaje, asegúrese de que sea imprescindible. Proteger el medio ambiente está a nuestro alcance.


[cid:imagebbfb93.JPG@507c5902.4e8840fd]



La información que contiene este correo electrónico es confidencial y compete exclusivamente al destinatario. Si Vd ha recibido esta comunicación por error, por favor, notifíquelo inmediatamente al remitente y borre el mensaje junto con sus ficheros anexos sin leerlo, copiarlo, grabarlo, distribuirlo o divulgarlo o hacer cualquier otro uso de la información sin el consentimiento de la empresa. El correo electrónico vía Internet no permite asegurar la confidencialidad o correcta recepción de los mensajes, por lo que Seidor no asume responsabilidad alguna por los daños causados.

The information contained in this communication is confidential, may be privileged and is intended for the exclusive use of the above named addressee. If you receive this communication in error, please notify the sender immediately and delete it, and all its attached documents. If you are not the intended recipient, you are expressly prohibited from reading, copying, distributing, disseminating or, in any other way, using any of the information without the company consent. Please note that Internet e-mail guarantees neither the confidentiality nor the proper receipt of the message sent, so that Seidor shall not be liable for any damages caused.