private static Procedure<?> newProcedure(String className) throws BadProcedureException {
    try {
      Class<?> clazz = Class.forName(className);
      if (!Modifier.isPublic(clazz.getModifiers())) {
        throw new Exception("the " + clazz + " class is not public");
      }

      @SuppressWarnings("rawtypes")
      Constructor<? extends Procedure> ctor = clazz.asSubclass(Procedure.class).getConstructor();
      assert ctor != null : "no constructor found";
      if (!Modifier.isPublic(ctor.getModifiers())) {
        throw new Exception("the " + clazz + " constructor is not public");
      }
      return ctor.newInstance();
    } catch (Exception e) {
      throw new BadProcedureException(
        "The procedure class " + className + " must be accessible and have an empty constructor",
        e);
    }
  }
Helper to convert to/from ProcedureProtos
hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureUtil.java