private RiakPB.RpbCommitHook convertHook(Function hook) {
      RiakPB.RpbCommitHook.Builder builder = RiakPB.RpbCommitHook.newBuilder();
      RiakPB.RpbModFun.Builder mfBuilder = RiakPB.RpbModFun.newBuilder();

      if (hook.isJavascript()) {
        builder.setName(ByteString.copyFromUtf8(hook.getName()));
      } else {
        mfBuilder.setModule(ByteString.copyFromUtf8(hook.getModule()));
        mfBuilder.setFunction(ByteString.copyFromUtf8(hook.getFunction()));
        builder.setModfun(mfBuilder);
      }

      return builder.build();
    }
 private RiakPB.RpbModFun convertModFun(Function f) {
   return RiakPB.RpbModFun.newBuilder()
       .setModule(ByteString.copyFromUtf8(f.getModule()))
       .setFunction(ByteString.copyFromUtf8(f.getFunction()))
       .build();
 }