Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '21'
java-version: '25'
distribution: 'liberica'
cache: maven

- name: Maven Tests
run: mvn --batch-mode clean test

- name: Test Coverage
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v7
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Expand Down
20 changes: 2 additions & 18 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@ void parse() {
// ... или reportPageFactory.create("1.xml");
// ... или reportPageFactory.create("1.csv");

// Метод найдет ячейку с текстом "Таблица 1",
// воспринимает следующую за ней строку как заголовок таблицы (который описан через enum TableHeader).
// Из последующих строк (до пустой строки или конца файла) извлекаются данные
// (метод использует бин ExcelTableFactory для создания таблицы Table на основе ReportPage)
Table table = reportPage.create("Таблица 1", TableHeader.class);
// Регистронезависимо найдет ячейку с текстом "Таблица 1" - это имя таблицы.
// Имя таблицы описано в единственной строке (2ой аргумент).
// Парсит следующую 1 строку (5ый аргумент) как заголовок таблицы (заголовок описан с помощью enum TableHeader).
// Последующие строки парсятся как данные до пустой строки или конца файла (3ий аргумент 'null')
// (метод использует бин ExcelTableFactory для создания таблицы Table на основе ReportPage).
Table table = reportPage.createTable("Таблица 1", 1, null, TableHeader.class, 1);

// Итерируемся по строкам таблицы и извлекаем ячейки из строк по заголовку таблицы
table.stream()
Expand All @@ -107,3 +108,24 @@ void parse() {
});
}
```

### Чтение таблиц из файла с вашим форматом данных
Автоконфигурация поставляет зависимости для чтения таблиц из excel, xml и csv файлов.
Если у вас есть собственная реализация формата [Table Wrapper API](https://github.com/spacious-team/table-wrapper-api),
прочтите таблицу следующим образом:
```java
// 1. Выполните регистрацию фабрики вашего формата данных
CustomTableFactory factory = new CustomTableFactory(); // CustomTableFactory implements TableFactory
TableFactoryRegistry.add(factory);

// 2. Создайте объект вашего класса доступа к данным, например из файла (может быть любой источник, кроме файла)
CustomReportPage reportPage = new CustomReportPage("My file.txt"); // CustomReportPage implements ReportPage

// 3. Прочитайте таблицу из вашего файла тем же API, что и для excel, xml, csv файла
Table table = reportPage.createTable("Таблица 1", 1, null, TableHeader.class, 1);
table.stream()
.forEach(row -> {
String product = row.getStringCellValue(TableHeader.PRODUCT);
BigDecimal price = getBigDecimalCellValue(TableHeader.PRICE);
});
```
40 changes: 40 additions & 0 deletions checkerframework.astub
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Table Wrapper Spring Boot Starter
* Copyright (C) 2026 Spacious Team <spacious-team@ya.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.function.Supplier;

package java.util;
public class Objects {

@EnsuresNonNull("#1")
static <T> T requireNonNull(@Nullable T obj);

@EnsuresNonNull("#1")
static <T> T requireNonNull(@Nullable T obj, String message);

@EnsuresNonNull("#1")
static <T> T requireNonNull(@Nullable T obj, Supplier<String> messageSupplier);

@EnsuresNonNullIf(expression="#1", result=true)
static boolean nonNull(@Nullable Object obj);

@EnsuresNonNullIf(expression="#1", result=false)
static boolean isNull(@Nullable Object obj);
}
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# https://docs.codecov.com/docs/codecov-yaml
coverage:
status:
project:
default:
threshold: 5% # allows to drop coverage (https://docs.codecov.com/docs/commit-status#project-status)
patch:
default:
target: 0% # allows no tests in PR (https://docs.codecov.com/docs/commit-status#patch-status)
50 changes: 43 additions & 7 deletions mvnw

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 48 additions & 8 deletions mvnw.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading