code: protected static final <T, K extends Serializable>
      K _key2Id(
                      final Key<T> key
                      )
      {
          K  id = null;
          try {
              @SuppressWarnings( "unchecked" )
              K  obj = (K)key.getId();
              id = obj;
          } catch (Exception ex) {
              throw new RepositoryException( ex );
          }
  
          return id;
      }
docs: Converts Morphia Key<T> to K, i.e. "_id".
  
  @throws  RepositoryException