private ReferenceDescriptorDef usedByReference ( ModelDef modelDef , FieldDescriptorDef fieldDef ) { String ownerClassName = ( ( ClassDescriptorDef ) fieldDef . getOwner ( ) ) . getQualifiedName ( ) ; ClassDescriptorDef classDef ; ReferenceDescriptorDef refDef ; String targetClassName ; // only relevant for primarykey fields if ( PropertyHelper . toBoolean ( fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_PRIMARYKEY ) , false ) ) { for ( Iterator classIt = modelDef . getClasses ( ) ; classIt . hasNext ( ) ; ) { classDef = ( ClassDescriptorDef ) classIt . next ( ) ; for ( Iterator refIt = classDef . getReferences ( ) ; refIt . hasNext ( ) ; ) { refDef = ( ReferenceDescriptorDef ) refIt . next ( ) ; targetClassName = refDef . getProperty ( PropertyHelper . OJB_PROPERTY_CLASS_REF ) . replace ( ' ' , ' ' ) ; if ( ownerClassName . equals ( targetClassName ) ) { // the field is a primary key of the class referenced by this reference descriptor return refDef ; } } } } return null ; }
Checks whether the given field definition is used as the primary key of a class referenced by a reference .