protected function required($objectName)
{
$method = "get{$objectName}";
$class = "Basho\\Riak\\{$objectName}";
$value = $this->{$method}();
if (is_null($value)) {
throw new Builder\Exception("Expected non-empty value for {$objectName}");
}
if (is_object($value) && $value instanceof $class === false) {
throw new Builder\Exception("Expected instance of {$class}, received instance of " . get_class($value));
}
if (is_array($value) && count($value) == 0) {
throw new Builder\Exception("Expected non-empty array value for {$objectName}");
}
}