class ConfigurationPropertyValidator {

  public static ImageReference getGeneratedTargetDockerTag(
      @Nullable String targetImage,
      ProjectProperties projectProperties,
      HelpfulSuggestions helpfulSuggestions)
      throws InvalidImageReferenceException {
    String generatedName = projectProperties.getName();
    String generatedTag =
        projectProperties.getVersion().equals("unspecified")
            ? "latest"
            : projectProperties.getVersion();
    if (Strings.isNullOrEmpty(targetImage)) {
      projectProperties.log(
          LogEvent.lifecycle(helpfulSuggestions.forGeneratedTag(generatedName, generatedTag)));

      // Try to parse generated tag to verify that project name and version are valid (throws an
      // exception if parse fails)
      ImageReference.parse(generatedName + ":" + generatedTag);
      return ImageReference.of(null, generatedName, generatedTag);
    } else {
      return ImageReference.parse(targetImage);
    }
  }

  private  ConfigurationPropertyValidator();

}