src/main/java/com/googlecode/objectify/impl/Keys.java
public com.google.cloud.datastore.Key anythingToRawKey(final Object keyOrEntity) {

		if (keyOrEntity instanceof com.google.cloud.datastore.Key)
			return (com.google.cloud.datastore.Key)keyOrEntity;
		else if (keyOrEntity instanceof Key<?>)
			return ((Key<?>)keyOrEntity).getRaw();
		else if (keyOrEntity instanceof Ref)
			return ((Ref<?>)keyOrEntity).key().getRaw();
		else if (keyOrEntity instanceof FullEntity<?>)
			return getKey((FullEntity<?>)keyOrEntity);
		else
			return rawKeyOf(keyOrEntity);
	}
public com.google.cloud.datastore.Key anythingToRawKey(final Object keyOrEntity) {

		if (keyOrEntity instanceof com.google.cloud.datastore.Key)
			return (com.google.cloud.datastore.Key)keyOrEntity;
		else if (keyOrEntity instanceof Key<?>)
			return ((Key<?>)keyOrEntity).getRaw();
		else if (keyOrEntity instanceof Ref)
			return ((Ref<?>)keyOrEntity).key().getRaw();
		else if (keyOrEntity instanceof FullEntity<?>)
			return getKey((FullEntity<?>)keyOrEntity);
		else
			return rawKeyOf(keyOrEntity);
	}
<p>Gets the raw datstore Key given an object that might be a Key, Key<T>, or entity.</p>

@param keyOrEntity must be a Key, Key<T>, or registered entity.
@throws NullPointerException if keyOrEntity is null
@throws IllegalArgumentException if keyOrEntity is not a Key, Key<T>, or registered entity