code: public static boolean checkValueIsType(Object value, Object name, Class type) {
          if (value != null) {
              if (type.isAssignableFrom(value.getClass())) {
                  return true;
              } else {
                  throw new RuntimeException("The value argument of '" + name + "' must be of type "
                          + type.getName() + ". Found: " + value.getClass());
              }
          } else {
              return false;
          }
      }
docs: Checks type of value against builder type
  
  @param value the node's value
  @param name  the node's name
  @param type  a Class that may be assignable to the value's class
  @return true if type is assignable to the value's class, false if value
  is null.