src/main/java/com/googlecode/objectify/impl/KeyMetadata.java
@SuppressWarnings("unchecked")
	private void setKey(final P pojo, final IncompleteKey key, final LoadContext ctx, final Path containerPath) {
		if (!clazz.isAssignableFrom(pojo.getClass()))
			throw new IllegalArgumentException("Trying to use metadata for " + clazz.getName() + " to set key of " + pojo.getClass().getName());

		// If no key, don't need to do anything
		if (key == null)
			return;

		idMeta.setValue(pojo, Keys.getIdValue(key), ctx, containerPath);

		final com.google.cloud.datastore.Key parentKey = key.getParent();
		if (parentKey != null) {
			if (this.parentMeta == null)
				throw new IllegalStateException("Loaded Entity has parent but " + clazz.getName() + " has no @Parent");

			parentMeta.setValue(pojo, (Value)KeyValue.of(parentKey), ctx, containerPath);
		}
	}
@SuppressWarnings("unchecked")
	private void setKey(final P pojo, final IncompleteKey key, final LoadContext ctx, final Path containerPath) {
		if (!clazz.isAssignableFrom(pojo.getClass()))
			throw new IllegalArgumentException("Trying to use metadata for " + clazz.getName() + " to set key of " + pojo.getClass().getName());

		// If no key, don't need to do anything
		if (key == null)
			return;

		idMeta.setValue(pojo, Keys.getIdValue(key), ctx, containerPath);

		final com.google.cloud.datastore.Key parentKey = key.getParent();
		if (parentKey != null) {
			if (this.parentMeta == null)
				throw new IllegalStateException("Loaded Entity has parent but " + clazz.getName() + " has no @Parent");

			parentMeta.setValue(pojo, (Value)KeyValue.of(parentKey), ctx, containerPath);
		}
	}
@ SuppressWarnings ( "unchecked" ) private void setKey ( final P pojo , final IncompleteKey key , final LoadContext ctx , final Path containerPath ) { if ( ! clazz . isAssignableFrom ( pojo . getClass ( ) ) ) throw new IllegalArgumentException ( "Trying to use metadata for " + clazz . getName ( ) + " to set key of " + pojo . getClass ( ) . getName ( ) ) ; // If no key, don't need to do anything if ( key == null ) return ; idMeta . setValue ( pojo , Keys . getIdValue ( key ) , ctx , containerPath ) ; final com . google . cloud . datastore . Key parentKey = key . getParent ( ) ; if ( parentKey != null ) { if ( this . parentMeta == null ) throw new IllegalStateException ( "Loaded Entity has parent but " + clazz . getName ( ) + " has no @Parent" ) ; parentMeta . setValue ( pojo , ( Value ) KeyValue . of ( parentKey ) , ctx , containerPath ) ; } }
Sets the key onto the POJO id/parent fields
Sets the key onto the POJO id / parent fields