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

com.mindee.product.generated.GeneratedV1Document Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.mindee.parsing.common.Prediction;
import com.mindee.parsing.generated.GeneratedFeature;
import com.mindee.parsing.generated.GeneratedV1PredictionDeserializer;
import java.util.Map;
import java.util.TreeMap;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;

/**
 * Document data for generated documents.
 */
@AllArgsConstructor
@Getter
@EqualsAndHashCode(callSuper = false)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(using = GeneratedV1PredictionDeserializer.class)
public class GeneratedV1Document extends Prediction {
  /**
   * Hashmap containing the fields of the document.
   */
  private Map fields;

  @Override
  public boolean isEmpty() {
    return fields.isEmpty();
  }

  public String toString() {
    TreeMap sorted = new TreeMap<>(fields);
    StringBuilder summary = new StringBuilder();
    for (Map.Entry entry : sorted.entrySet()) {
      summary.append(String.format(":%s: %s%n", entry.getKey(), entry.getValue()));
    }
    return summary.toString();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy