mygreen / super-csv-annotation Goto Github PK
View Code? Open in Web Editor NEW'Super CSV' extention library for annotation
License: Apache License 2.0
'Super CSV' extention library for annotation
License: Apache License 2.0
If bean column values are public, they are returned by both getFields() and getDeclaredFields(). Therefore, all public field mappings are added twice and validatePosition() failes with duplicated positions.
Instead, use getDeclaredFields() which should get you everything, including public fields. There is no reason to call both.
This would be really great to have on maven central!
合成のアノテーション時において、属性cases は共通の属性なので、@CsvOverridesAttribute
を付与しなくても上書きできるようにすべき。
when setting anntoation @CsvColumn(unique=true, trim=true), throw exception.
ver.1.2
・fix annotation attr langauge, countr with @CsvDateConverter and @CsvNumberConverter.
ver1.2
非推奨のアノテーションの属性の削除を行う。
When not setting @DateConverter, default locale not reflect.
ver1.2.
・add interface 'CellProcessorBuilderFactory'.
==> customized creating builderFacetory instance.
・add intaferace 'CellProcessorBuilder'
・remove NullCellProcessorBuilder to DefaultCellProcessorBuilder.
ResourceBundleMessageResolver
を使って、propertiesファイルを読み込むときに、asciiコードに変換しているファイルを前提としているが、UTF-8で変換なしで取り込めるようにする。
Enum parsing error ins message, I want use enums choise list.
BeanValidation2.0(JSR-380)がリリースされたので対応を行う。
OffsetDateTime/OffsetTime/Year/YearMonth/MonthDay
に新たに対応する。YearMonth/MonthDay
に新たに対応。新しいCell Processorに対応する。
If the label attribute is not specified, the field name is used as the label. If the label attribute IS specified then SuperCSV looks for a getter/setter with that label name. If those getter/setter methods are created, there is no need for the label attribute since the getter/setter encapsulates the field anyway and the actual field could be named anything. What is the point of the label attribute if not to allow a column to be mapped to a field named something else? Getter/setter methods should be generated automatically based on annotations instead of allowing SuperCSV to look for missing accessor/mutator.
アノテーションの属性名で、意味がおかしいものを変更する。
@CsvBooleanConverter
ライブラリ使わせていただいてます。
ラベルによるカラムマッピングで一点お願いがあるのですが、
@CsvColumn(label="生年月日")
@CsvDateTimeFormat(pattern="uuuu/MM/dd")
private LocalDate birthday;
↑のようにラベルのみでカラム指定して、そのラベルと一致するヘッダが無いCSVを読み込んだ場合に、numberが0扱いになってしまうためSuperCsvInvalidAnnotationExceptionが発行されてしまいます。
アノテーションの付け方が悪いようなエラー内容になっていますが、どちらかといえばユーザ操作の問題かと思いますので、ヘッダのバリデーションチェック関連のExceptionに変更できないでしょうか?
↓Exception発行箇所は以下です。(複数見つからなかった場合は0の重複、一つの場合は1以上を指定)
ver1.2
・move master file 'SuperCsvMessages.properties' from package 'org.supercsv.ext' to 'org.supercsv.ext.localization'.
・load locale 'SuperCsvMessages.properties'.
独自のTokenizerに、カラムの長さの情報を渡して、区切り文字のない固定長に対応する。
ver1.2
各種テスタが作成されていないので作成する。
java.lang.ExceptionInInitializerError
at org.supercsv.ext.localization.MessageConverter.(MessageConverter.java:23)
at org.supercsv.ext.CsvAnnotationBeanWriterTest.testRead3(CsvAnnotationBeanWriterTest.java:265)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.util.MissingResourceException: Can't find bundle for base name org/supercsv/ext/SuperCSVMessages, locale ja_JP
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at org.supercsv.ext.localization.ResourceBundleMessageResolver.(ResourceBundleMessageResolver.java:37)
at org.supercsv.ext.localization.ResourceBundleMessageResolver.(ResourceBundleMessageResolver.java:33)
... 26 more
Java8から追加された、LocalDate、LocalTime、LocalDateTimeなどに対応する。
アノテーション @CsvFullChar/CsvHalfChar
を設定しても、大文字・小文字に置換されない。
インタフェース ReplacedWordProvoder
のメソッド getReplacedWords
の戻り値のReplacedWordを内部クラスにする。
CellProcessorの WordReplaceなどと間際らしいため。
// 変更前
@FunctionalInterface
public interface ReplacedWordProvider {
Collection<ReplacedWord> getReplacedWords(FieldAccessor field);
}
// 変更後
@FunctionalInterface
public interface ReplacedWordProvider {
public static class Word {
private String word;
private String replacement;
}
Collection<Word> getReplacedWords(FieldAccessor field);
}
Bean Validationが v3.0から Jakartaプロジェクトに変わったため対応を行う。
CsvRegexReplaceのアノテーションを使用して正規表現に該当する任意の文字列を複数置換することができません。
matcher.matches()
を使用すると完全一致の比較になってしまいます。
部分一致させてmatcher.replacheAll()
を呼ぶ場合、matcher.find()
が適切かと思います。
または、CsvRegexReplaceはCsvRegexReplaceFirstとして、CsvRegexReplaceAllとして作成したほうが良いでしょうか?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.