src/main/java/com/googlecode/objectify/impl/KeyMetadata.java
public IncompleteKey getIncompleteKey(final P pojo) {
		log.trace("Getting key from {}", pojo);

		if (!clazz.isAssignableFrom(pojo.getClass()))
			throw new IllegalArgumentException("Trying to use metadata for " + clazz.getName() + " to get key of " + pojo.getClass().getName());

		final Object id = getId(pojo);
		final com.google.cloud.datastore.Key parent = getParentRaw(pojo);

		if (id == null)
			return factory.keys().createRawIncomplete(parent, kind);
		else
			return factory.keys().createRawAny(parent, kind, id);
	}
public IncompleteKey getIncompleteKey(final P pojo) {
		log.trace("Getting key from {}", pojo);

		if (!clazz.isAssignableFrom(pojo.getClass()))
			throw new IllegalArgumentException("Trying to use metadata for " + clazz.getName() + " to get key of " + pojo.getClass().getName());

		final Object id = getId(pojo);
		final com.google.cloud.datastore.Key parent = getParentRaw(pojo);

		if (id == null)
			return factory.keys().createRawIncomplete(parent, kind);
		else
			return factory.keys().createRawAny(parent, kind, id);
	}
public IncompleteKey getIncompleteKey ( final P pojo ) { log . trace ( "Getting key from {}" , pojo ) ; if ( ! clazz . isAssignableFrom ( pojo . getClass ( ) ) ) throw new IllegalArgumentException ( "Trying to use metadata for " + clazz . getName ( ) + " to get key of " + pojo . getClass ( ) . getName ( ) ) ; final Object id = getId ( pojo ) ; final com . google . cloud . datastore . Key parent = getParentRaw ( pojo ) ; if ( id == null ) return factory . keys ( ) . createRawIncomplete ( parent , kind ) ; else return factory . keys ( ) . createRawAny ( parent , kind , id ) ; }
Gets a key composed of the relevant id and parent fields in the object.

@param pojo must be of the entityClass type for this metadata.
@return either a Key or IncompleteKey depending on whether the id is null or not
Gets a key composed of the relevant id and parent fields in the object .