public function createObject($meta, $mapped, $args=null)
    {
        if (!$meta instanceof Meta) {
            $meta = $this->getMeta($meta);
        }

        $object = null;
        $args = $args ? array_values($args) : [];
        $argc = $args ? count($args) : 0;

        if ($meta->constructorArgs) {
            $actualArgs = [];
            foreach ($meta->constructorArgs as $argInfo) {
                $type = $argInfo[0];
                $id   = isset($argInfo[1]) ? $argInfo[1] : null;

                switch ($type) {
                case 'property':
                    $actualArgs[] = isset($mapped->{$id}) ? $mapped->{$id} : null;
                    unset($mapped->{$id});
                break;

                case 'arg':
                    if ($id >= $argc) {
                        throw new Exception("Class {$meta->class} requires argument at index $id - please use Select->\$args");
                    }
                    $actualArgs[] = $args[$id];
                break;

                case 'all': $actualArgs[] = $mapped; break;

                // NO! leaky abstraction.
                // case 'meta': $actualArgs[] = $meta; break;

                default:
                    throw new Exception("Invalid constructor argument type {$type}");
                }
            }
            $args = $actualArgs;
        }

        if ($meta->constructor == '__construct') {
            if ($args) {
                $rc = new \ReflectionClass($meta->class);
                $object = $rc->newInstanceArgs($args);
            }
            else {
                $cname = $meta->class;
                $object = new $cname;
            }
        }
        else {
            $rc = new \ReflectionClass($meta->class);
            $method = $rc->getMethod($meta->constructor);
            $object = $method->invokeArgs(null, $args ?: []);
        }

        if (!$object instanceof $meta->class) {
            throw new Exception(
                "Constructor {$meta->constructor} did not return instance of {$meta->class}"
            );
        }

        return $object;
    }