code: public static boolean validate(@Nullable String name) {
      if (name == null) {
        return false;
      } else if (name.isEmpty()) {
        return false;
      } else if (name.startsWith("-")) {
        return false;
      } else if (name.endsWith("-")) {
        return false;
      } else if (name.length() > 63) {
        return false;
      } else {
        for (char c : name.toCharArray()) {
          if (Character.isLetterOrDigit(c)) {
            continue;
          } else if (c == '-') {
            continue;
          } else {
            return false;
          }
        }
      }
  
      return true;
    }
docs: Validates an App Engine service name.
  
  @param name App Engine service (a.k.a. module) name
  @return true if and only if the name meets the constraints for service names; false otherwise