com.mindee.parsing.standard.AmountField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mindee-api-java Show documentation
Show all versions of mindee-api-java Show documentation
Java Library to call Mindee's Off-The-Shelf and Custom APIs
The newest version!
package com.mindee.parsing.standard;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.mindee.geometry.Polygon;
import com.mindee.geometry.PolygonDeserializer;
import com.mindee.parsing.SummaryHelper;
import lombok.Getter;
/**
* Represent an amount.
*/
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
public class AmountField extends BaseField {
/**
* An amount value.
*/
@JsonProperty("value")
private Double value;
public AmountField(
@JsonProperty("value")
Double value,
@JsonProperty("confidence")
Double confidence,
@JsonProperty("polygon")
@JsonDeserialize(using = PolygonDeserializer.class)
Polygon polygon,
@JsonProperty("page_id")
Integer pageId
) {
super(confidence, polygon, pageId);
this.value = value;
}
public boolean isEmpty() {
return this.value == null;
}
@Override
public String toString() {
return SummaryHelper.formatAmount(this.value);
}
}