code: private Identity getReferencedObjectIdentity(Object obj, ObjectReferenceDescriptor rds, ClassDescriptor cld)
      {
          Object[] fkValues = rds.getForeignKeyValues(obj, cld);
          FieldDescriptor[] fkFieldDescriptors = rds.getForeignKeyFieldDescriptors(cld);
          boolean hasNullifiedFKValue = hasNullifiedFK(fkFieldDescriptors, fkValues);
          /*
          BRJ: if all fk values are null there's no referenced object
  
          arminw: Supposed the given object has nullified FK values but the referenced
          object still exists. This could happend after serialization of the main object. In
          this case all anonymous field (AK) information is lost, because AnonymousPersistentField class
          use the object identity to cache the AK values. But we can build Identity anyway from the reference
          */
          if (hasNullifiedFKValue)
          {
              if(BrokerHelper.hasAnonymousKeyReference(cld, rds))
              {
                  Object referencedObject = rds.getPersistentField().get(obj);
                  if(referencedObject != null)
                  {
                      return pb.serviceIdentity().buildIdentity(referencedObject);
                  }
              }
          }
          else
          {
              // ensure that top-level extents are used for Identities
              return pb.serviceIdentity().buildIdentity(rds.getItemClass(), pb.getTopLevelClass(rds.getItemClass()), fkValues);
          }
          return null;
      }
docs: retrieves an Object reference's Identity.
  <br>
  Null is returned if all foreign keys are null