You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Marcos Hass W <ma...@gmail.com> on 2006/09/15 22:12:13 UTC

.betwix file assigned to a JDK class

Hi all,

I have a class that extends
java.beans.beancontext.BeanContextChildSupportits name is
AbstractBean, below a snippet.:


/** <tt>JavaBean</tt> base responsável pelos mecanismos de notificação de
alteração
 * de propriedades e clonagem. A extensão a partir de
<tt>BeanContextChildSupport</tt>
 * permite que o bean seja posicionado dentro de um <tt>BeanContext</tt> e
esteja
 * apto a questionar propriedades existentes em outros beans presentes
também no
 * contexto.
 *
 * @author marcos
 */
public abstract class AbstractBean extends BeanContextChildSupport
        implements Cloneable, Comparable, Serializable {

    /** Delegate <tt>PropertyChangeSupport</tt> responsável pela notificação
dos
     * listeners atentos às alterações nas propriedades do
<tt>javabean</tt>.
     *
     * @see <a href="
http://java.sun.com/docs/books/tutorial/javabeans/properties/bound.html">
     *
http://java.sun.com/docs/books/tutorial/javabeans/properties/bound.html</a>
     */
    protected transient PropertyChangeSupport changes = new
PropertyChangeSupport(this);

    /** Delegate a <tt>VetoableChangeSupport</tt> responsável pela
notificação
     * dos <tt>VetoableChangeListeners</tt> que irão escutar os valores
alterados
     * e irão <tt>vetar</tt> ou não a alteração.
     */
    protected transient VetoableChangeSupport vetoable = new
VetoableChangeSupport(this);

    /** Constructor de <code>AbstractBean</code>.*/
    public AbstractBean() {
        super();

        beanContextChildPeer = this;

        pcSupport = new PropertyChangeSupport(beanContextChildPeer);
        vcSupport = new VetoableChangeSupport(beanContextChildPeer);
    }

    public AbstractBean(BeanContextChild bcc) {
        super();

        beanContextChildPeer = (bcc != null) ? bcc : this;

        pcSupport = new PropertyChangeSupport(beanContextChildPeer);
        vcSupport = new VetoableChangeSupport(beanContextChildPeer);
    }

//...

}

I have several bean classes that extend AbstractBean and any time I try to
submit these extended classes to BeanWriter I get a CyclicReferenceException
.
I've discovered that BeanContextChildSupport has some fields that produce
this cyclic problem and for this reason I've associated a
AbstractBean.betwixt file to the AbstractBean class as follows:

<?xml version='1.0' encoding='UTF-8' ?>
<info primitiveTypes='attribute'>

    <element name='abstractbean'>
        <hide property='beanContext'/>
        <hide property='beanContextChildPeer'/>
        <hide property='pcSupport'/>
        <hide property='rejectedSetBCOnce'/>
        <hide property='vcSupport'/>
        <hide property='changes'/>
        <hide property='vetoable'/>
        <addDefaults/>

    </element>

</info>

The problem is that I'm still getting the cyclic problem ;-(
Does someone know what's wrong ?
How do I associate a .betwixt file with the
java.beans.beancontext.BeanContextChildSupport class ?

Thank you very much
Marcos