io.github.sinri.keel.poi.excel.entity.KeelSheetMatrixTemplatedRowImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Keel Show documentation
Show all versions of Keel Show documentation
A website framework with VERT.X for ex-PHP-ers, exactly Ark Framework Users.
The newest version!
package io.github.sinri.keel.poi.excel.entity;
import io.vertx.core.json.JsonObject;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Objects;
/**
* @since 3.0.13
* @since 3.0.18 Finished Technical Preview.
*/
public class KeelSheetMatrixTemplatedRowImpl implements KeelSheetMatrixTemplatedRow {
private final KeelSheetMatrixRowTemplate template;
private final List rawRow;
KeelSheetMatrixTemplatedRowImpl(@Nonnull KeelSheetMatrixRowTemplate template, @Nonnull List rawRow) {
this.template = template;
this.rawRow = rawRow;
}
@Override
public KeelSheetMatrixRowTemplate getTemplate() {
return template;
}
@Override
public String getColumnValue(int i) {
return this.rawRow.get(i);
}
@Override
public String getColumnValue(String name) {
Integer columnIndex = getTemplate().getColumnIndex(name);
return this.rawRow.get(Objects.requireNonNull(columnIndex));
}
/**
* @since 3.2.16 Fix bug
*/
@Override
public List getRawRow() {
return rawRow;
}
@Override
public JsonObject toJsonObject() {
var x = new JsonObject();
List columnNames = this.template.getColumnNames();
for (int i = 0; i < columnNames.size(); i++) {
x.put(columnNames.get(i), getColumnValue(i));
}
return x;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy