private boolean hasBidirectionalAssociation(Class clazz)
    {
        ClassDescriptor cdesc;
        Collection refs;
        boolean hasBidirAssc;

        if (_withoutBidirAssc.contains(clazz))
        {
            return false;
        }

        if (_withBidirAssc.contains(clazz))
        {
            return true;
        }

        // first time we meet this class, let's look at metadata
        cdesc = _pb.getClassDescriptor(clazz);
        refs = cdesc.getObjectReferenceDescriptors();
        hasBidirAssc = false;
        REFS_CYCLE:
        for (Iterator it = refs.iterator(); it.hasNext(); )
        {
            ObjectReferenceDescriptor ord;
            ClassDescriptor relCDesc;
            Collection relRefs;

            ord = (ObjectReferenceDescriptor) it.next();
            relCDesc = _pb.getClassDescriptor(ord.getItemClass());
            relRefs = relCDesc.getObjectReferenceDescriptors();
            for (Iterator relIt = relRefs.iterator(); relIt.hasNext(); )
            {
                ObjectReferenceDescriptor relOrd;

                relOrd = (ObjectReferenceDescriptor) relIt.next();
                if (relOrd.getItemClass().equals(clazz))
                {
                    hasBidirAssc = true;
                    break REFS_CYCLE;
                }
            }
        }
        if (hasBidirAssc)
        {
            _withBidirAssc.add(clazz);
        }
        else
        {
            _withoutBidirAssc.add(clazz);
        }

        return hasBidirAssc;
    }
private boolean hasBidirectionalAssociation ( Class clazz ) { ClassDescriptor cdesc ; Collection refs ; boolean hasBidirAssc ; if ( _withoutBidirAssc . contains ( clazz ) ) { return false ; } if ( _withBidirAssc . contains ( clazz ) ) { return true ; } cdesc = _pb . getClassDescriptor ( clazz ) ; refs = cdesc . getObjectReferenceDescriptors ( ) ; hasBidirAssc = false ; REFS_CYCLE : for ( Iterator it = refs . iterator ( ) ; it . hasNext ( ) ; ) { ObjectReferenceDescriptor ord ; ClassDescriptor relCDesc ; Collection relRefs ; ord = ( ObjectReferenceDescriptor ) it . next ( ) ; relCDesc = _pb . getClassDescriptor ( ord . getItemClass ( ) ) ; relRefs = relCDesc . getObjectReferenceDescriptors ( ) ; for ( Iterator relIt = relRefs . iterator ( ) ; relIt . hasNext ( ) ; ) { ObjectReferenceDescriptor relOrd ; relOrd = ( ObjectReferenceDescriptor ) relIt . next ( ) ; if ( relOrd . getItemClass ( ) . equals ( clazz ) ) { hasBidirAssc = true ; break REFS_CYCLE ; } } } if ( hasBidirAssc ) { _withBidirAssc . add ( clazz ) ; } else { _withoutBidirAssc . add ( clazz ) ; } return hasBidirAssc ; }
Does the given class has bidirectional assiciation
with some other class?