All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mindee.product.resume.ResumeV1SocialNetworksUrl Maven / Gradle / Ivy

The newest version!
package com.mindee.product.resume;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.mindee.parsing.SummaryHelper;
import com.mindee.parsing.standard.BaseField;
import com.mindee.parsing.standard.LineItemField;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;

/**
 * The list of social network profiles of the candidate.
 */
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
public class ResumeV1SocialNetworksUrl extends BaseField implements LineItemField {

  /**
   * The name of the social network.
   */
  @JsonProperty("name")
  String name;
  /**
   * The URL of the social network.
   */
  @JsonProperty("url")
  String url;

  public boolean isEmpty() {
    return (
        (name == null || name.isEmpty())
        && (url == null || url.isEmpty())
      );
  }

  private Map tablePrintableValues() {
    Map printable = new HashMap<>();

    printable.put("name", SummaryHelper.formatForDisplay(this.name, 20));
    printable.put("url", SummaryHelper.formatForDisplay(this.url, 50));
    return printable;
  }

  /**
   * Output the line in a format suitable for inclusion in an rST table.
   */
  public String toTableLine() {
    Map printable = this.tablePrintableValues();
    return String.format("| %-20s ", printable.get("name"))
      + String.format("| %-50s |", printable.get("url"));
  }

  @Override
  public String toString() {
    Map printable = this.printableValues();
    return String.format("Name: %s", printable.get("name"))
      + String.format(", URL: %s", printable.get("url"));
  }

  private Map printableValues() {
    Map printable = new HashMap<>();

    printable.put("name", SummaryHelper.formatForDisplay(this.name, null));
    printable.put("url", SummaryHelper.formatForDisplay(this.url, null));
    return printable;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy