code: private void processKeyField(Field field) {
      String fieldName = field.getName();
      Class<?> type = field.getType();
      if (!type.equals(DatastoreKey.class)) {
        String message = String.format("Invalid type, %s, for Key field %s in class %s. ", type,
            fieldName, entityClass);
        throw new EntityManagerException(message);
      }
      KeyMetadata keyMetadata = new KeyMetadata(field);
      entityMetadata.setKeyMetadata(keyMetadata);
    }
docs: Processes the Key field and builds the entity metadata.
  
  @param field
  the Key field