io.annot8.common.data.bounds.CellBounds Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annot8-common-data Show documentation
Show all versions of annot8-common-data Show documentation
Common data (bounds and content) definitions
The newest version!
/* Annot8 (annot8.io) - Licensed under Apache-2.0. */
package io.annot8.common.data.bounds;
import io.annot8.api.data.Content;
import io.annot8.api.exceptions.Annot8RuntimeException;
import io.annot8.common.data.content.Row;
import io.annot8.common.data.content.Table;
import io.annot8.common.data.content.TableContent;
import jakarta.json.bind.annotation.JsonbCreator;
import jakarta.json.bind.annotation.JsonbProperty;
import java.util.Optional;
public class CellBounds extends AbstractCellBounds {
private final int row;
private final int column;
@JsonbCreator
public CellBounds(@JsonbProperty("row") int row, @JsonbProperty("column") int column) {
this.row = row;
this.column = column;
}
@Override
public , R> Optional getData(C content, Class requiredClass) {
if (isValid(content)) {
Table table = (Table) content.getData();
Optional optional = table.getRow(row);
if (optional.isEmpty()) {
throw new Annot8RuntimeException("Failed to find row");
}
Optional
© 2015 - 2024 Weber Informatics LLC | Privacy Policy