Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.3のリリース準備(バージョン更新/ドキュメント更新) #135

Merged
merged 10 commits into from
Jan 2, 2025
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ Apache License verion 2.0

# Depends
+ Java1.8
+ Apache POI v5.1.0
+ SpringFramework 3.0+ (optional)
+ BeanValidation 1.0/1.1/2.0 (optional)
+ Apache POI v5.1.0+
+ Spring Framework 3.0+ (optional)
+ Bean Validation 1.0/1.1/2.0 (optional)
+ Jakarta Bean Validation 3.0/3.1 (optional)

# Setup

Expand All @@ -23,7 +24,7 @@ Apache License verion 2.0
<dependency>
<groupId>com.github.mygreen</groupId>
<artifactId>xlsmapper</artifactId>
<version>2.2</version>
<version>2.3</version>
</dependency>
```

Expand All @@ -38,7 +39,7 @@ Apache License verion 2.0

# Build

1. Setup Java SE 8 (1.8.0_121+)
1. Setup Java SE 8
2. Setup Maven
3. Build jar files.
```console
Expand Down
2 changes: 1 addition & 1 deletion deploy.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ call env.bat

call mvn -version

call mvn clean deploy
call mvn clean verify deploy

pause
87 changes: 17 additions & 70 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.github.mygreen</groupId>
<artifactId>xlsmapper</artifactId>
<packaging>jar</packaging>
<version>2.2</version>
<version>2.3</version>
<name>XlsMapper</name>
<url>http://mygreen.github.io/xlsmapper/</url>
<description><![CDATA[
Expand All @@ -23,17 +23,6 @@ XlsMapper is Java Library for mapping Excel sheets to POJO.
<url>https://github.com/mygreen/xlsmapper</url>
</scm>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
Expand Down Expand Up @@ -62,53 +51,8 @@ XlsMapper is Java Library for mapping Excel sheets to POJO.
<poi.version>5.1.0</poi.version>
<spring.version>3.2.11.RELEASE</spring.version>
<jacoco.include.package>com.gh.mygreen.xlsmapper.*</jacoco.include.package>

<!-- SonarQubeの解析から除外したいファイル -->
<sonar.exclusions>
**/sample/*,
**/*Test.*,
**/*.js,
</sonar.exclusions>
<sonar.projectName>${project.groupId}/${project.artifactId}</sonar.projectName>
<sonar.host.url>https://sonarcloud.io/</sonar.host.url>
<sonar.organization>mygreen-github</sonar.organization>
<sonar.coverage.jacoco.xmlReportPaths>${project.directory}/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<profiles>
<profile>
<id>deploy</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- Prevent `gpg` from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<resources>
<resource>
Expand Down Expand Up @@ -314,19 +258,26 @@ $(document).ready(function() {
</dependencies>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.7.0.1746</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.7</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.6.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
</configuration>
</plugin>

Expand Down Expand Up @@ -563,10 +514,6 @@ $(document).ready(function() {
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
16 changes: 7 additions & 9 deletions src/site/sphinx/source/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@
});
</script>

<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-37313068-2', 'auto');
ga('send', 'pageview');

<script async src="https://www.googletagmanager.com/gtag/js?id=G-YS0Q8PMB62"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-YS0Q8PMB62');
</script>

{{ super() }}
Expand Down
7 changes: 4 additions & 3 deletions src/site/sphinx/source/annotation_formula.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ Javaのアノテーションの仕様上、属性valueのみを指定する時
* - 関数の形式
- 説明

* - ``x:colToAlpha(<列番号>)``
- 1から始まる列番号を英字名に変換します。
* - ``f:colToAlpha(<列番号>)``
- | 1から始まる列番号を英字名に変換します。
| v2.2以前では、関数の接頭語は ``x:`` でした。v2.3から ``f:`` に変更されました。


自身のJavaBeanも変数 ``targetBean`` として登録されているため、任意のメソッドを呼び出すこともできます。
Expand Down Expand Up @@ -115,7 +116,7 @@ Javaのアノテーションの仕様上、属性valueのみを指定する時

// 数式の指定(変数、EL式を使用して指定)
@XlsColumn(columnName="合計")
@XlsFormula(value="SUM(${x:colToAlpha(targetBean.kokugoColNum)}{rowNumber}:${x:colToAlpha(targetBean.sansuColNum)}{rowNumber})", primary=true)
@XlsFormula(value="SUM(${f:colToAlpha(targetBean.kokugoColNum)}{rowNumber}:${f:colToAlpha(targetBean.sansuColNum)}{rowNumber})", primary=true)
private int sum;

// プロパティ「kokugo」の列番号を返す。
Expand Down
4 changes: 2 additions & 2 deletions src/site/sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@

# General information about the project.
project = u'XlsMapper'
copyright = u'2015-2022, T.TSUCHIE'
copyright = u'2015-2025, T.TSUCHIE'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.2'
version = '2.3'
# The full version, including alpha/beta/rc tags.
release = version

Expand Down
152 changes: 3 additions & 149 deletions src/site/sphinx/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,152 +2,6 @@
システム設定
====================================================


読み込み時及び書き込み時の動作をConfigurationクラスでカスタマイズできます。

.. sourcecode:: java
:linenos:

// 設定用のオブジェクトConfigurationの作成
Configuration config = new Configuration();

// シートが見つからない場合にエラーにしない。
config.setIgnoreSheetNotFound(true);

// ConfigurationクラスをXlsMapperに渡す。
XlsMapper xlsMapper = new XlsMapper();
xlsMapper.setConfiguration(config);

// 設定を変更したXlsMapperでシートの読み込み
SheetObject sheet = xlsMapper.load(
new FileInputStream("example.xls"), SheetObject.class);


Configurationは、XlsMapperクラスのインスタンスを作成時にも持っているため、次のような変更もできます。

.. sourcecode:: java
:linenos:

XlsMapper xlsMapper = new XlsMapper();

// XlsMapperクラスから直接XlsMapperConfigのインスタンスを取得し変更する。
xlsMapper.getConfiguration().setIgnoreSheetNotFound(true);

// 設定を変更したXlsMapperでシートの読み込み
SheetObject sheet = xlsMapper.load(
new FileInputStream("example.xls"), SheetObject.class);

Configurationでは以下の設定ができます。

.. list-table:: Configurationで設定可能な項目
:widths: 20 30 50
:header-rows: 1

* - プロパティ名
- クラス型
- 説明

* - ``ignoreSheetNotFound``
- ``boolean``
- | シートが見つからなくても無視するかどうか。
| 初期値は'false'です

* - ``normalizeLabelText``
- ``boolean``
- | ラベルを正規化(空白、改行、タブを除去)して、マッピングするかどうか
| 初期値は'false'です。
| **Ver.1.1以上** から利用可能です。

* - ``regexLabelText``
- ``boolean``
- | マッピングするラベルに ``/正規表現/`` と記述しておくと正規表現でマッピングできるかどうか。
| 初期値は'false'です。
| **Ver.1.1以上** から利用可能です。

* - ``continueTypeBindFailure``
- ``boolean``
- | 型変換エラーが発生しても処理を続けるかどうか。
| 初期値は'false'です。
| **Ver1.1以前** は、 ``skipTypeBindFailure`` という名称です。

* - ``mergeCellOnSave``
- ``boolean``
- | 書き込み時にセルの結合を行うかどうか。
| アノテーション :doc:`@XlsColumn <annotation_mapping_column>` の属性mergedを書き込み時も考慮します。
| 初期値は'false'です。

* - ``correctNameRangeOnSave``
- ``boolean``
- | 書き込み時に名前の定義範囲を修正するかどうか。
| アノテーション :doc:`@XlsHorizontalRecords <annotation_mapping_horizontalrecords>` 、:doc:`@XlsVerticalRecords <annotation_mapping_verticalrecords>` でレコードの追加を行った箇所に名前の定義があるときに考慮します。
| 初期値は'false'です。
| **Ver.0.3以上** から利用可能です。

* - ``correctCellDataValidationOnSave``
- ``boolean``
- | 書き込み時に名前のセルの入力規則を修正するかどうか。
| アノテーション :doc:`@XlsHorizontalRecords <annotation_mapping_horizontalrecords>` 、:doc:`@XlsVerticalRecords <annotation_mapping_verticalrecords>` でレコードの追加を行った箇所に入力規則が設定されているときに考慮します。
| 初期値は'false'です。
| **Ver.0.3以上** から利用可能です。

* - ``formulaRecalcurationOnSave``
- ``boolean``
- | 書き込み時に式の再計算をするか設定します。
| 数式を含むシートを出力したファイルを開いた場合、一般的には数式が開いたときに再計算されます。
| ただし、大量で複雑な数式が記述されていると、パフォーマンスが落ちるため 'false' 設定すると無効にすることもできます。
| 初期値は'true'です。
| **Ver.1.5以上** から利用可能です。

* - ``cacheCellValueOnLoad``
- ``boolean``
- | 読み込み時にセルの値をキャッシュして処理速度の向上を行うかどうか。書き込み時に名前のセルの入力規則を修正するかどうか。
| 初期値は'true'です。
| **Ver.2.0以上** から利用可能です。

* - ``cellFormatter``
- ``CellFormatter``
- | POIのセルの値をフォーマットして文字列として取得するクラスです。
| 実装は、Ver.0.4から `Excel-CellFormatter <https://github.com/mygreen/excel-cellformatter>`_ を利用しています。

* - ``fieldProcessorRegistry``
- ``FieldProcessorRegstry``
- | フィールドプロセッサーを管理します。

* - ``converterRegistry``
- ``CellConverterRegistry``
- | セルの値をJavaオブジェクトに変換するクラスを管理します。

* - ``beanFactory``
- ``BeanFactory``
- | 読み込み時などのJavaBeansオブジェクトのインスタンスを作成すためのコールバック用クラス。
| 独自の実装を渡すことで、SpringFrameworkなどのDIコンテナで管理しているクラスを使用できます。

* - ``bindingErrorsFactory``
- ``SheetBindingErrorsFactory``
- | マッピング時のエラー情報 ``SheetBindingErrors`` のインスタンスを作成すためのコールバック用クラス。
| 独自の実装を渡すことで、SpringFrameworkなどのDIコンテナで管理しているクラスを使用できます。
| **Ver.2.0以上** から利用可能です。

* - ``sheetFinder``
- ``SheetFinder``
- | アノテーション :doc:`@XlsSheet <annotation_mapping_sheet>` に基づき処理対象のシートを抽出するクラス。
| **Ver.1.1以上** から利用可能です。

* - ``formulaFormatter``
- ``MessageInterpolator``
- | アノテーション :ref:`@XlsFormula <annotationFormula>` の属性 ``value`` で指定した数式を独自の変数やEL式をフォーマットする際に利用します。
| **Ver.1.5以上** から利用可能です。

* - ``annotationMapping``
- ``AnnotationMappingInfo``
- | XMLなどによるアノテーションのマッピング情報を設定します。
| 詳細は、:doc:`xmlmapping` のを参照してください。
| **Ver.2.0以上** から利用可能です。

* - ``commentOperator``
- ``CellCommentOperator``
- | セルのコメント情報をマッピングするデフォルトの処理を設定します。
| 詳細は、:doc:`sheetinfo_comment` や :doc:`@XlsCommentOption <annotation_mapping_commentoption>` を参照してください。
| **Ver.2.1以上** から利用可能です。


.. 以降は、埋め込んで作成する
.. include:: ./configuration_configuration.rst
.. include:: ./configuration_systemproperty.rst
Loading
Loading