private void cloneNestedFeatures(NestedDef nestedDef, ArrayList newFields, ArrayList newReferences, ArrayList newCollections)
    {
        ClassDescriptorDef      nestedClassDef = nestedDef.getNestedType();
        String                  prefix         = nestedDef.getName()+"::";
        FieldDescriptorDef      copyFieldDef;
        ReferenceDescriptorDef  copyRefDef;
        CollectionDescriptorDef copyCollDef;
        StringBuffer            newForeignkey;

        for (Iterator fieldIt = nestedClassDef.getFields(); fieldIt.hasNext();)
        {
            copyFieldDef = cloneField((FieldDescriptorDef)fieldIt.next(), prefix);
            if (!contains(newFields, copyFieldDef))
            {
                copyFieldDef.setNested();
                newFields.add(copyFieldDef);
            }
        }
        for (Iterator refIt = nestedClassDef.getReferences(); refIt.hasNext();)
        {
            copyRefDef = cloneReference((ReferenceDescriptorDef)refIt.next(), prefix);
            if (contains(newReferences, copyRefDef))
            {
                continue;
            }
            copyRefDef.setNested();

            // we have to modify the foreignkey setting as it specifies a field of the same (nested) class
            newForeignkey = new StringBuffer();

            for (CommaListIterator it = new CommaListIterator(copyRefDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY)); it.hasNext();)
            {
                if (newForeignkey.length() > 0)
                {
                    newForeignkey.append(",");
                }
                newForeignkey.append(prefix);
                newForeignkey.append(it.next());
            }
            copyRefDef.setProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY, newForeignkey.toString());
            newReferences.add(copyRefDef);
        }
        for (Iterator collIt = nestedClassDef.getCollections(); collIt.hasNext();)
        {
            copyCollDef = cloneCollection((CollectionDescriptorDef)collIt.next(), prefix);
            if (!contains(newCollections, copyCollDef))
            {
                copyCollDef.setNested();
                newCollections.add(copyCollDef);
            }
        }
    }
private void cloneNestedFeatures ( NestedDef nestedDef , ArrayList newFields , ArrayList newReferences , ArrayList newCollections ) { ClassDescriptorDef nestedClassDef = nestedDef . getNestedType ( ) ; String prefix = nestedDef . getName ( ) + "::" ; FieldDescriptorDef copyFieldDef ; ReferenceDescriptorDef copyRefDef ; CollectionDescriptorDef copyCollDef ; StringBuffer newForeignkey ; for ( Iterator fieldIt = nestedClassDef . getFields ( ) ; fieldIt . hasNext ( ) ; ) { copyFieldDef = cloneField ( ( FieldDescriptorDef ) fieldIt . next ( ) , prefix ) ; if ( ! contains ( newFields , copyFieldDef ) ) { copyFieldDef . setNested ( ) ; newFields . add ( copyFieldDef ) ; } } for ( Iterator refIt = nestedClassDef . getReferences ( ) ; refIt . hasNext ( ) ; ) { copyRefDef = cloneReference ( ( ReferenceDescriptorDef ) refIt . next ( ) , prefix ) ; if ( contains ( newReferences , copyRefDef ) ) { continue ; } copyRefDef . setNested ( ) ; newForeignkey = new StringBuffer ( ) ; for ( CommaListIterator it = new CommaListIterator ( copyRefDef . getProperty ( PropertyHelper . OJB_PROPERTY_FOREIGNKEY ) ) ; it . hasNext ( ) ; ) { if ( newForeignkey . length ( ) > 0 ) { newForeignkey . append ( "," ) ; } newForeignkey . append ( prefix ) ; newForeignkey . append ( it . next ( ) ) ; } copyRefDef . setProperty ( PropertyHelper . OJB_PROPERTY_FOREIGNKEY , newForeignkey . toString ( ) ) ; newReferences . add ( copyRefDef ) ; } for ( Iterator collIt = nestedClassDef . getCollections ( ) ; collIt . hasNext ( ) ; ) { copyCollDef = cloneCollection ( ( CollectionDescriptorDef ) collIt . next ( ) , prefix ) ; if ( ! contains ( newCollections , copyCollDef ) ) { copyCollDef . setNested ( ) ; newCollections . add ( copyCollDef ) ; } } }
Clones the features of the given nested object (using modifications if available) and puts them into
the given lists.

@param nestedDef      The nested object
@param newFields      Recieves the field copies
@param newReferences  Recieves the reference copies
@param newCollections Recieves the collection copies