├── .gitignore ├── .travis.yml ├── JLHA-LICENSE.txt ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── checkstyle.xml ├── pom.xml └── src ├── license └── THIRD-PARTY.properties ├── main ├── assembly │ └── bin.xml ├── java │ └── com │ │ └── orangesignal │ │ ├── csv │ │ ├── Csv.java │ │ ├── CsvConfig.java │ │ ├── CsvHandler.java │ │ ├── CsvListHandler.java │ │ ├── CsvReader.java │ │ ├── CsvResultSet.java │ │ ├── CsvResultSetMetaData.java │ │ ├── CsvToken.java │ │ ├── CsvTokenException.java │ │ ├── CsvValueException.java │ │ ├── CsvWriter.java │ │ ├── LhaEntryFilter.java │ │ ├── QuotePolicy.java │ │ ├── SerializationUtils.java │ │ ├── SimpleCsvToken.java │ │ ├── ZipEntryFilter.java │ │ ├── annotation │ │ │ ├── CsvColumn.java │ │ │ ├── CsvColumnAccessType.java │ │ │ ├── CsvColumnException.java │ │ │ ├── CsvColumns.java │ │ │ ├── CsvEntity.java │ │ │ └── package-info.java │ │ ├── bean │ │ │ ├── AbstractCsvBeanTemplate.java │ │ │ ├── CsvBeanOperation.java │ │ │ ├── CsvBeanTemplate.java │ │ │ ├── CsvColumnNameMappingBeanOperation.java │ │ │ ├── CsvColumnNameMappingBeanTemplate.java │ │ │ ├── CsvColumnPositionMappingBeanOperation.java │ │ │ ├── CsvColumnPositionMappingBeanTemplate.java │ │ │ ├── CsvEntityOperation.java │ │ │ ├── CsvEntityTemplate.java │ │ │ ├── CsvValueConverter.java │ │ │ ├── FieldUtils.java │ │ │ ├── FormatUtils.java │ │ │ ├── SimpleCsvValueConverter.java │ │ │ └── package-info.java │ │ ├── entryfilters │ │ │ ├── AbstractEntryFilter.java │ │ │ ├── DirectoryEntryFilter.java │ │ │ ├── EntryNameFilter.java │ │ │ ├── PrefixEntryNameFilter.java │ │ │ ├── RegexEntryNameFilter.java │ │ │ ├── SuffixEntryNameFilter.java │ │ │ └── package-info.java │ │ ├── filters │ │ │ ├── BeanAndExpression.java │ │ │ ├── BeanBetweenExpression.java │ │ │ ├── BeanCriteriaExpression.java │ │ │ ├── BeanCriteriasExpression.java │ │ │ ├── BeanEmptyExpression.java │ │ │ ├── BeanEqualExpression.java │ │ │ ├── BeanExpression.java │ │ │ ├── BeanExpressionUtils.java │ │ │ ├── BeanExpressions.java │ │ │ ├── BeanFilter.java │ │ │ ├── BeanGreaterThanExpression.java │ │ │ ├── BeanGreaterThanOrEqualExpression.java │ │ │ ├── BeanInExpression.java │ │ │ ├── BeanLessThanExpression.java │ │ │ ├── BeanLessThanOrEqualExpression.java │ │ │ ├── BeanLogicalExpression.java │ │ │ ├── BeanNotEmptyExpression.java │ │ │ ├── BeanNotEqualExpression.java │ │ │ ├── BeanNotExpression.java │ │ │ ├── BeanNotInExpression.java │ │ │ ├── BeanNotNullExpression.java │ │ │ ├── BeanNullExpression.java │ │ │ ├── BeanOrExpression.java │ │ │ ├── BeanRegexExpression.java │ │ │ ├── ColumnNameBetweenExpression.java │ │ │ ├── ColumnNameCriteriaExpression.java │ │ │ ├── ColumnNameCriteriasExpression.java │ │ │ ├── ColumnNameEmptyExpression.java │ │ │ ├── ColumnNameEqualExpression.java │ │ │ ├── ColumnNameExpression.java │ │ │ ├── ColumnNameGreaterThanExpression.java │ │ │ ├── ColumnNameGreaterThanOrEqualExpression.java │ │ │ ├── ColumnNameInExpression.java │ │ │ ├── ColumnNameLessThanExpression.java │ │ │ ├── ColumnNameLessThanOrEqualExpression.java │ │ │ ├── ColumnNameNotEmptyExpression.java │ │ │ ├── ColumnNameNotEqualExpression.java │ │ │ ├── ColumnNameNotInExpression.java │ │ │ ├── ColumnNameNotNullExpression.java │ │ │ ├── ColumnNameNullExpression.java │ │ │ ├── ColumnNameRegexExpression.java │ │ │ ├── ColumnPositionBetweenExpression.java │ │ │ ├── ColumnPositionCriteriaExpression.java │ │ │ ├── ColumnPositionCriteriasExpression.java │ │ │ ├── ColumnPositionEmptyExpression.java │ │ │ ├── ColumnPositionEqualExpression.java │ │ │ ├── ColumnPositionExpression.java │ │ │ ├── ColumnPositionGreaterThanExpression.java │ │ │ ├── ColumnPositionGreaterThanOrEqualExpression.java │ │ │ ├── ColumnPositionInExpression.java │ │ │ ├── ColumnPositionLessThanExpression.java │ │ │ ├── ColumnPositionLessThanOrEqualExpression.java │ │ │ ├── ColumnPositionNotEmptyExpression.java │ │ │ ├── ColumnPositionNotEqualExpression.java │ │ │ ├── ColumnPositionNotInExpression.java │ │ │ ├── ColumnPositionNotNullExpression.java │ │ │ ├── ColumnPositionNullExpression.java │ │ │ ├── ColumnPositionRegexExpression.java │ │ │ ├── CsvExpressionUtils.java │ │ │ ├── CsvExpressions.java │ │ │ ├── CsvNamedValueAndExpression.java │ │ │ ├── CsvNamedValueFilter.java │ │ │ ├── CsvNamedValueLogicalExpression.java │ │ │ ├── CsvNamedValueNotExpression.java │ │ │ ├── CsvNamedValueOrExpression.java │ │ │ ├── CsvValueAndExpression.java │ │ │ ├── CsvValueFilter.java │ │ │ ├── CsvValueLogicalExpression.java │ │ │ ├── CsvValueNotExpression.java │ │ │ ├── CsvValueOrExpression.java │ │ │ ├── SimpleBeanFilter.java │ │ │ ├── SimpleCsvNamedValueFilter.java │ │ │ ├── SimpleCsvValueFilter.java │ │ │ └── package-info.java │ │ ├── handlers │ │ │ ├── .DS_Store │ │ │ ├── AbstractBeanListHandler.java │ │ │ ├── AbstractCsvListHandler.java │ │ │ ├── BeanListHandler.java │ │ │ ├── BeanOrder.java │ │ │ ├── BeanOrderComparator.java │ │ │ ├── ColumnNameMapListHandler.java │ │ │ ├── ColumnNameMappingBeanListHandler.java │ │ │ ├── ColumnPositionMapListHandler.java │ │ │ ├── ColumnPositionMappingBeanListHandler.java │ │ │ ├── CsvEntityListHandler.java │ │ │ ├── ResultSetHandler.java │ │ │ ├── StringArrayListHandler.java │ │ │ └── package-info.java │ │ ├── io │ │ │ ├── CsvBeanReader.java │ │ │ ├── CsvBeanWriter.java │ │ │ ├── CsvColumnNameMapReader.java │ │ │ ├── CsvColumnNameMapWriter.java │ │ │ ├── CsvColumnNameMappingBeanReader.java │ │ │ ├── CsvColumnNameMappingBeanWriter.java │ │ │ ├── CsvColumnPositionMapReader.java │ │ │ ├── CsvColumnPositionMapWriter.java │ │ │ ├── CsvColumnPositionMappingBeanReader.java │ │ │ ├── CsvColumnPositionMappingBeanWriter.java │ │ │ ├── CsvEntityReader.java │ │ │ ├── CsvEntityWriter.java │ │ │ └── package-info.java │ │ ├── manager │ │ │ ├── AbstractCsvLoader.java │ │ │ ├── AbstractCsvSaver.java │ │ │ ├── CsvBeanLoader.java │ │ │ ├── CsvBeanManager.java │ │ │ ├── CsvBeanSaver.java │ │ │ ├── CsvColumnNameMappingBeanLoader.java │ │ │ ├── CsvColumnNameMappingBeanManager.java │ │ │ ├── CsvColumnNameMappingBeanSaver.java │ │ │ ├── CsvColumnPositionMappingBeanLoader.java │ │ │ ├── CsvColumnPositionMappingBeanManager.java │ │ │ ├── CsvColumnPositionMappingBeanSaver.java │ │ │ ├── CsvEntityLoader.java │ │ │ ├── CsvEntityManager.java │ │ │ ├── CsvEntitySaver.java │ │ │ ├── CsvLoader.java │ │ │ ├── CsvManager.java │ │ │ ├── CsvManagerFactory.java │ │ │ ├── CsvSaver.java │ │ │ └── package-info.java │ │ └── package-info.java │ │ └── jlha │ │ ├── BadHuffmanTableException.java │ │ ├── BinaryTreeSearch.java │ │ ├── BitDataBrokenException.java │ │ ├── BitInputStream.java │ │ ├── BitOutputStream.java │ │ ├── Bits.java │ │ ├── CRC16.java │ │ ├── CachedInputStream.java │ │ ├── CompressMethod.java │ │ ├── Disconnectable.java │ │ ├── DisconnectableInputStream.java │ │ ├── DisconnectableOutputStream.java │ │ ├── DynamicHuffman.java │ │ ├── Factory.java │ │ ├── GrowthByteBuffer.java │ │ ├── HashAndBinaryTreeSearch.java │ │ ├── HashAndChainedListSearch.java │ │ ├── HashDefault.java │ │ ├── HashMethod.java │ │ ├── HashShort.java │ │ ├── LhaChecksum.java │ │ ├── LhaFile.java │ │ ├── LhaHeader.java │ │ ├── LhaImmediateOutputStream.java │ │ ├── LhaInputStream.java │ │ ├── LhaOutputStream.java │ │ ├── LhaProperty.java │ │ ├── LhaRetainedOutputStream.java │ │ ├── LimitedInputStream.java │ │ ├── LittleEndian.java │ │ ├── LzssInputStream.java │ │ ├── LzssOutputStream.java │ │ ├── LzssSearchMethod.java │ │ ├── MsdosDate.java │ │ ├── NotEnoughBitsException.java │ │ ├── PatriciaTrieSearch.java │ │ ├── PostLh1Encoder.java │ │ ├── PostLh2Encoder.java │ │ ├── PostLh3Encoder.java │ │ ├── PostLh5Encoder.java │ │ ├── PostLz5Encoder.java │ │ ├── PostLzsEncoder.java │ │ ├── PostLzssEncoder.java │ │ ├── PreLh1Decoder.java │ │ ├── PreLh2Decoder.java │ │ ├── PreLh3Decoder.java │ │ ├── PreLh5Decoder.java │ │ ├── PreLz5Decoder.java │ │ ├── PreLzsDecoder.java │ │ ├── PreLzssDecoder.java │ │ ├── SimpleSearch.java │ │ ├── StaticHuffman.java │ │ ├── TwoLevelHashSearch.java │ │ ├── Type.java │ │ └── package-info.java ├── javadoc │ └── overview.html └── resources │ ├── orangesignal-jlha.properties │ └── orangesignal-jlha_ja.properties ├── site ├── apt │ ├── csv_library_feature_matrix.apt │ ├── faq.apt │ ├── index.apt │ ├── io_tables.apt │ ├── migration.apt.vm │ ├── quick_start.apt.vm │ ├── release_notes.apt │ └── userguide.apt └── site_ja.xml └── test ├── java └── com │ └── orangesignal │ └── csv │ ├── Constants.java │ ├── CsvConfigTest.java │ ├── CsvReaderBenchmarks.java │ ├── CsvReaderTest.java │ ├── CsvResultSetMetaDataTest.java │ ├── CsvResultSetTest.java │ ├── CsvTest.java │ ├── CsvWriterTest.java │ ├── QuotePolicyTest.java │ ├── Seasar2Test.java │ ├── SerializationUtilsTest.java │ ├── SimpleCsvTokenTest.java │ ├── SpringTest.java │ ├── annotation │ └── CsvColumnExceptionTest.java │ ├── bean │ ├── CsvBeanTemplateTest.java │ ├── NullCsvValueConverter.java │ └── SimpleCsvValueConverterTest.java │ ├── entity │ ├── DefaultValuePrice.java │ ├── IntArrayEntity.java │ ├── IntegerArrayEntity.java │ ├── Issue30.java │ ├── Price.java │ ├── Price2.java │ ├── RequiredPrice.java │ ├── StringArrayEntity.java │ ├── Travel.java │ ├── WritableEntity.java │ └── WritableNoHeaderEntity.java │ ├── entryfilters │ ├── DirectoryEntryFilterTest.java │ ├── EntryNameFilterTest.java │ ├── PrefixEntryNameFilterTest.java │ ├── RegexEntryNameFilterTest.java │ └── SuffixEntryNameFilterTest.java │ ├── filters │ ├── BeanAndExpressionTest.java │ ├── BeanBetweenExpressionTest.java │ ├── BeanEmptyExpressionTest.java │ ├── BeanEqualExpressionTest.java │ ├── BeanExpressionUtilsTest.java │ ├── BeanExpressionsTest.java │ ├── BeanGreaterThanExpressionTest.java │ ├── BeanGreaterThanOrEqualExpressionTest.java │ ├── BeanInExpressionTest.java │ ├── BeanLessThanExpressionTest.java │ ├── BeanLessThanOrEqualExpressionTest.java │ ├── BeanNotEmptyExpressionTest.java │ ├── BeanNotEqualExpressionTest.java │ ├── BeanNotExpressionTest.java │ ├── BeanNotInExpressionTest.java │ ├── BeanNotNullExpressionTest.java │ ├── BeanNullExpressionTest.java │ ├── BeanOrExpressionTest.java │ ├── BeanRegexExpressionTest.java │ ├── ColumnNameBetweenExpressionTest.java │ ├── ColumnNameEmptyExpressionTest.java │ ├── ColumnNameEqualExpressionTest.java │ ├── ColumnNameGreaterThanExpressionTest.java │ ├── ColumnNameGreaterThanOrEqualExpressionTest.java │ ├── ColumnNameInExpressionTest.java │ ├── ColumnNameLessThanExpressionTest.java │ ├── ColumnNameLessThanOrEqualExpressionTest.java │ ├── ColumnNameNotEmptyExpressionTest.java │ ├── ColumnNameNotEqualExpressionTest.java │ ├── ColumnNameNotInExpressionTest.java │ ├── ColumnNameNotNullExpressionTest.java │ ├── ColumnNameNullExpressionTest.java │ ├── ColumnNameRegexExpressionTest.java │ ├── ColumnPositionBetweenExpressionTest.java │ ├── ColumnPositionEmptyExpressionTest.java │ ├── ColumnPositionEqualExpressionTest.java │ ├── ColumnPositionGreaterThanExpressionTest.java │ ├── ColumnPositionGreaterThanOrEqualExpressionTest.java │ ├── ColumnPositionInExpressionTest.java │ ├── ColumnPositionLessThanExpressionTest.java │ ├── ColumnPositionLessThanOrEqualExpressionTest.java │ ├── ColumnPositionNotEmptyExpressionTest.java │ ├── ColumnPositionNotEqualExpressionTest.java │ ├── ColumnPositionNotInExpressionTest.java │ ├── ColumnPositionNotNullExpressionTest.java │ ├── ColumnPositionNullExpressionTest.java │ ├── ColumnPositionRegexExpressionTest.java │ ├── CsvExpressionUtilsTest.java │ ├── CsvExpressionsTest.java │ ├── CsvNamedValueAndExpressionTest.java │ ├── CsvNamedValueNotExpressionTest.java │ ├── CsvNamedValueOrExpressionTest.java │ ├── CsvValueAndExpressionTest.java │ ├── CsvValueNotExpressionTest.java │ ├── CsvValueOrExpressionTest.java │ ├── SimpleBeanFilterTest.java │ ├── SimpleCsvNamedValueFilterTest.java │ └── SimpleCsvValueFilterTest.java │ ├── handlers │ ├── BeanListHandlerTest.java │ ├── BeanOrderComparatorTest.java │ ├── BeanOrderTest.java │ ├── ColumnNameMapListHandlerTest.java │ ├── ColumnNameMappingBeanListHandlerTest.java │ ├── ColumnPositionMapListHandlerTest.java │ ├── ColumnPositionMappingBeanListHandlerTest.java │ ├── CsvEntityListHandlerTest.java │ ├── ResultSetHandlerTest.java │ ├── SampleType.java │ └── StringArrayListHandlerTest.java │ ├── io │ ├── CsvBeanReaderTest.java │ ├── CsvBeanWriterTest.java │ ├── CsvColumnNameMapReaderTest.java │ ├── CsvColumnNameMapWriterTest.java │ ├── CsvColumnNameMappingBeanReaderTest.java │ ├── CsvColumnNameMappingBeanWriterTest.java │ ├── CsvColumnPositionMapReaderTest.java │ ├── CsvColumnPositionMapWriterTest.java │ ├── CsvColumnPositionMappingBeanReaderTest.java │ ├── CsvColumnPositionMappingBeanWriterTest.java │ ├── CsvEntityReaderTest.java │ └── CsvEntityWriterTest.java │ ├── manager │ ├── CsvBeanLoaderTest.java │ ├── CsvBeanManagerTest.java │ ├── CsvBeanSaverTest.java │ ├── CsvColumnNameMappingBeanManagerTest.java │ ├── CsvColumnPositionMappingBeanManagerTest.java │ ├── CsvEntityManagerTest.java │ └── CsvManagerFactoryTest.java │ └── model │ ├── Sample.java │ ├── SampleBean.java │ └── SamplePrice.java └── resources ├── META-INF └── services │ └── com.orangesignal.csv.manager.CsvManager ├── app.dicon ├── applicationContext.xml ├── convention.dicon ├── creator.dicon ├── customizer.dicon ├── env.txt ├── env_ut.txt ├── jdbc.dicon ├── ken_all.lzh ├── log4j.properties ├── n225.csv ├── n225.lzh ├── n225.zip ├── s2container.dicon ├── sample.zip └── utf8bom.csv /.gitignore: -------------------------------------------------------------------------------- 1 | # Java Files 2 | *.class 3 | *.jar 4 | 5 | # Maven Files 6 | /target 7 | target/* 8 | core/target/* 9 | legacy/target/* 10 | 11 | cobertura.ser 12 | 13 | # MacOS Files 14 | .DS_Store 15 | 16 | # Eclipse Files # 17 | .project 18 | .classpath 19 | org.eclipse.*.prefs 20 | */.settings/* 21 | 22 | # IDEA artifacts and output dirs 23 | *.iml 24 | *.ipr 25 | *.iws 26 | .idea 27 | atlassian-ide-plugin.xml 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | jdk: 4 | - openjdk6 5 | 6 | branches: 7 | only: 8 | - master 9 | 10 | script: "mvn -e clean install license:add-third-party" 11 | -------------------------------------------------------------------------------- /JLHA-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2001-2002 Michel Ishizuka All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or 4 | without modification, are permitted provided that the following 5 | conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY MICHEL ISHIZUKA ``AS IS'' AND ANY 17 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 18 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MICHEL 20 | ISHIZUKA BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 27 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | OrangeSignal CSV 2 | Copyright 2009-2014 OrangeSignal.com 3 | 4 | The binary distributions includes the following third party software: 5 | JLHA (http://homepage1.nifty.com/dangan/Content/Program/Java/jLHA/jLHA.html). 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [OrangeSignal CSV](http://orangesignal.github.io/orangesignal-csv/) [![Build Status](https://travis-ci.org/orangesignal/orangesignal-csv.png?branch=master)](https://travis-ci.org/orangesignal/orangesignal-csv) 2 | 3 | OrangeSignal CSV is a very flexible csv (comma-separated values) read and write library for Java. 4 | 5 | The binary distributions includes the following third party software: 6 | [jLHA (LHA Library for Java)](http://homepage1.nifty.com/dangan/en/Content/Program/Java/jLHA/jLHA.html). 7 | 8 | ## Prerequisites 9 | 10 | * Java 1.6+ 11 | OrangeSignal CSV is compiled for Java 1.6 12 | 13 | ## Installation 14 | 15 | ### Maven users 16 | 17 | If you are using Maven, simply copy the following dependency into your pom.xml file. The artifact is hosted at [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Corangesignal-csv), and is standalone (no dependencies). 18 | 19 | ```xml 20 | 21 | com.orangesignal 22 | orangesignal-csv 23 | 2.2.1 24 | 25 | ``` 26 | 27 | ## Examples 28 | 29 | CSV entity class 30 | 31 | ```java 32 | @CsvEntity(header = true) 33 | public class Customer { 34 | 35 | @CsvColumn(name = "name") 36 | public String name; 37 | 38 | @CsvColumn(name = "age") 39 | public Integer age; 40 | 41 | } 42 | ``` 43 | 44 | example code 45 | 46 | 47 | ```java 48 | CsvConfig cfg = new CsvConfig(',', '"', '"'); 49 | cfg.setNullString("NULL"); 50 | cfg.setIgnoreLeadingWhitespaces(true); 51 | cfg.setIgnoreTrailingWhitespaces(true); 52 | cfg.setIgnoreEmptyLines(true); 53 | cfg.setIgnoreLinePatterns(Pattern.compile("^#.*$")); 54 | cfg.setVariableColumns(false); 55 | 56 | List list = new CsvEntityManager() 57 | .config(cfg) 58 | .load(Customer.class) 59 | .filter(new SimpleBeanFilter().in("name", "Smith", "Johnson").gt("age", 21)) 60 | .offset(10) 61 | .limit(1000) 62 | .order(BeanOrder.desc("age")) 63 | .from(reader); 64 | ``` 65 | 66 | ## How to use 67 | 68 | * [User guide](http://orangesignal.github.io/orangesignal-csv/userguide.html) 69 | * [Migration](http://orangesignal.github.io/orangesignal-csv/migration.html) 70 | 71 | Sorry, it is japanese only for now. 72 | 73 | ## License 74 | 75 | * Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). 76 | -------------------------------------------------------------------------------- /src/license/THIRD-PARTY.properties: -------------------------------------------------------------------------------- 1 | # Generated by org.codehaus.mojo.license.AddThirdPartyMojo 2 | #------------------------------------------------------------------------------- 3 | # Already used licenses in project : 4 | # - The Apache Software License, Version 2.0 5 | #------------------------------------------------------------------------------- 6 | # Please fill the missing licenses for dependencies : 7 | # 8 | # 9 | ognl--ognl--2.6.9-patch-20090427=The Apache Software License, Version 2.0 10 | org.apache.geronimo.specs--geronimo-j2ee_1.4_spec--1.0=The Apache Software License, Version 2.0 -------------------------------------------------------------------------------- /src/main/assembly/bin.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | bin 17 | 18 | zip 19 | 20 | false 21 | 22 | 23 | 24 | *LICENSE.txt 25 | NOTICE.txt 26 | changelog.txt 27 | 28 | 29 | 30 | ${project.build.directory} 31 | 32 | 33 | *.jar 34 | 35 | 36 | 37 | ${project.build.directory}/apidocs 38 | docs 39 | 40 | options 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/CsvHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 区切り文字形式データのデータアクセスインターフェースです。 23 | * 24 | * @param 区切り文字形式データの型 25 | * @author Koji Sugisawa 26 | */ 27 | public interface CsvHandler { 28 | 29 | /** 30 | * 区切り文字形式入力ストリームを読込んで区切り文字形式データを返します。 31 | * 32 | * @param reader 区切り文字形式入力ストリーム 33 | * @return 区切り文字形式データ 34 | * @throws IOException 入出力例外が発生した場合 35 | * @throws IllegalArgumentException パラメータが不正な場合 36 | */ 37 | T load(CsvReader reader) throws IOException; 38 | 39 | /** 40 | * 指定された区切り文字形式データを区切り文字形式出力ストリームへ書込みます。 41 | * 42 | * @param obj 区切り文字形式データ 43 | * @param writer 区切り文字形式出力ストリーム 44 | * @throws IOException 入出力例外が発生した場合 45 | * @throws IllegalArgumentException パラメータが不正な場合 46 | */ 47 | void save(T obj, CsvWriter writer) throws IOException; 48 | 49 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/CsvToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | /** 20 | * 区切り文字形式データトークンのインタフェースです。 21 | * 22 | * @author Koji Sugisawa 23 | */ 24 | public interface CsvToken { 25 | 26 | /** 27 | * トークンの値を保持します、 28 | * 29 | * @return トークンの値 30 | */ 31 | String getValue(); 32 | 33 | /** 34 | * トークンの開始物理行番号を取得します。 35 | * 36 | * @return トークンの開始物理行番号 37 | */ 38 | int getStartLineNumber(); 39 | 40 | /** 41 | * トークンの終了物理行番号を取得します。 42 | * 43 | * @return トークンの終了物理行番号 44 | */ 45 | int getEndLineNumber(); 46 | 47 | /** 48 | * トークンが囲み文字で囲まれていたかどうかを返します。 49 | * 50 | * @return トークンが囲み文字で囲まれていたかどうか 51 | */ 52 | boolean isEnclosed(); 53 | 54 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/CsvTokenException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import java.io.IOException; 20 | import java.util.List; 21 | 22 | /** 23 | * 区切り文字形式データトークンに関しての例外が発生した場合にスローされる例外を提供します。 24 | * 25 | * @author Koji Sugisawa 26 | * @since 2.1 27 | */ 28 | public class CsvTokenException extends IOException { 29 | 30 | private static final long serialVersionUID = 3908133388773744080L; 31 | 32 | /** 33 | * 区切り文字形式データトークンのリストを保持します。 34 | */ 35 | private final List tokens; 36 | 37 | /** 38 | * 指定された詳細メッセージと区切り文字形式データトークンのリストを持つ {@link CsvTokenException} を構築します。 39 | * 40 | * @param message 詳細メッセージ 41 | * @param tokens 区切り文字形式データトークンの値リスト 42 | */ 43 | public CsvTokenException(final String message, final List tokens) { 44 | super(message); 45 | this.tokens = tokens; 46 | } 47 | 48 | /** 49 | * 区切り文字形式データトークンのリストを返します。 50 | * 51 | * @return 区切り文字形式データトークンのリスト 52 | */ 53 | public List getTokens() { 54 | return tokens; 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/CsvValueException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import java.io.IOException; 20 | import java.util.List; 21 | 22 | /** 23 | * 区切り文字形式データトークンの値に関しての例外が発生した場合にスローされる例外を提供します。 24 | * 25 | * @author Koji Sugisawa 26 | * @since 2.1 27 | */ 28 | public class CsvValueException extends IOException { 29 | 30 | private static final long serialVersionUID = -2047098167770188272L; 31 | 32 | /** 33 | * 区切り文字形式データトークンの値リストを保持します。 34 | */ 35 | private final List values; 36 | 37 | /** 38 | * 指定された詳細メッセージと区切り文字形式データトークンの値リストを持つ {@link CsvValueException} を構築します。 39 | * 40 | * @param message 詳細メッセージ 41 | * @param values 区切り文字形式データトークンの値リスト 42 | */ 43 | public CsvValueException(final String message, final List values) { 44 | super(message); 45 | this.values = values; 46 | } 47 | 48 | /** 49 | * 区切り文字形式データトークンの値リストを返します。 50 | * 51 | * @return 区切り文字形式データトークンの値リスト 52 | */ 53 | public List getValues() { 54 | return values; 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/LhaEntryFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import com.orangesignal.jlha.LhaHeader; 20 | 21 | /** 22 | * LHA エントリフィルタのインタフェースです。 23 | * このインタフェースを実装するクラスのインスタンスは、{@link Csv} クラスの {@code load} メソッドによるエントリリストをフィルタ処理するために使われます。 24 | * 25 | * @author Koji Sugisawa 26 | */ 27 | public interface LhaEntryFilter { 28 | 29 | /** 30 | * 指定された LHA エントリが含まれる必要があるかどうかを判定します。 31 | * 32 | * @param entry テスト対象の LHA エントリ 33 | * @return {@code entry} が含まれる必要がある場合は {@code true} 34 | */ 35 | boolean accept(LhaHeader entry); 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/QuotePolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | /** 20 | * 囲み文字出力方法の種類を表す列挙型を提供します。 21 | * 22 | * @author Koji Sugisawa 23 | * @since 1.1 24 | */ 25 | public enum QuotePolicy { 26 | 27 | /** 28 | * 全ての項目を囲み文字で囲むようにします。 29 | */ 30 | ALL, 31 | 32 | /** 33 | * 項目内に区切り文字、囲み文字または改行文字が含まれる場合にだけ項目を囲み文字で囲むようにします。 34 | */ 35 | MINIMAL; 36 | 37 | // NON_NUMERIC 38 | 39 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/SimpleCsvToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import java.io.Serializable; 20 | 21 | /** 22 | * {@link CsvToken} を実装したデフォルトの実装クラスを提供します。 23 | * 24 | * @author Koji Sugisawa 25 | */ 26 | public class SimpleCsvToken implements Serializable, CsvToken { 27 | 28 | private static final long serialVersionUID = 9180143360016401191L; 29 | 30 | /** 31 | * トークンの値を保持します。 32 | */ 33 | private String value; 34 | 35 | /** 36 | * トークンの開始物理行番号を保持します。 37 | */ 38 | private int startLineNumber; 39 | 40 | /** 41 | * トークンの終了物理行番号を保持します。 42 | */ 43 | private int endLineNumber; 44 | 45 | /** 46 | * トークンが囲み文字で囲まれていたかどうかを保持します。 47 | */ 48 | private boolean enclosed; 49 | 50 | /** 51 | * デフォルトコンストラクタです。 52 | */ 53 | protected SimpleCsvToken() { 54 | } 55 | 56 | /** 57 | * コンストラクタです。 58 | * 59 | * @param value トークンの値 60 | * @param start トークンの開始物理行番号 61 | * @param end トークンの終了物理行番号 62 | * @param enclosed トークンが囲み文字で囲まれていたかどうか 63 | */ 64 | public SimpleCsvToken(final String value, final int start, final int end, final boolean enclosed) { 65 | this.value = value; 66 | this.startLineNumber = start; 67 | this.endLineNumber = end; 68 | this.enclosed = enclosed; 69 | } 70 | 71 | @Override public String getValue() { return value; } 72 | @Override public int getStartLineNumber() { return startLineNumber; } 73 | @Override public int getEndLineNumber() { return endLineNumber; } 74 | @Override public boolean isEnclosed() { return enclosed; } 75 | 76 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/ZipEntryFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import java.util.zip.ZipEntry; 20 | 21 | /** 22 | * ZIP エントリフィルタのインタフェースです。 23 | * このインタフェースを実装するクラスのインスタンスは、{@link Csv} クラスの {@code load} メソッドによるエントリリストをフィルタ処理するために使われます。 24 | * 25 | * @author Koji Sugisawa 26 | */ 27 | public interface ZipEntryFilter { 28 | 29 | /** 30 | * 指定された ZIP エントリが含まれる必要があるかどうかを判定します。 31 | * 32 | * @param entry テスト対象の ZIP エントリ 33 | * @return {@code entry} が含まれる必要がある場合は {@code true} 34 | */ 35 | boolean accept(ZipEntry entry); 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/annotation/CsvColumnException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.annotation; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * この例外は、区切り文字形式のデータ項目の検証操作実行中にエラーが発生したことを示します。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 2.2 26 | */ 27 | public class CsvColumnException extends IOException { 28 | 29 | private static final long serialVersionUID = -4822064613042281469L; 30 | 31 | /** 32 | * 原因となったオブジェクトを保持します。 33 | */ 34 | private final Object object; 35 | 36 | /** 37 | * 指定された詳細メッセージと原因となったオブジェクトを持つ {@link CsvColumnException} を構築します。 38 | * 39 | * @param message 詳細メッセージ 40 | * @param object 原因となったオブジェクト 41 | */ 42 | public CsvColumnException(final String message, final Object object) { 43 | super(message); 44 | this.object = object; 45 | } 46 | 47 | /** 48 | * 原因となったオブジェクトを返します。 49 | * 50 | * @return 原因となったオブジェクトまたは {@code null} 51 | */ 52 | public Object getObject() { 53 | return object; 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/annotation/CsvColumns.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.annotation; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * フィールドが区切り文字形式の複数のデータ項目であることを示します。 26 | * 27 | * @author Koji Sugisawa 28 | * @since 1.2.1 29 | */ 30 | @Target({ ElementType.FIELD, ElementType.METHOD }) 31 | @Retention(RetentionPolicy.RUNTIME) 32 | public @interface CsvColumns { 33 | 34 | /** 35 | * {@link CsvColumn} の列挙を返します。 36 | * 37 | * @return {@link CsvColumn} の列挙 38 | */ 39 | CsvColumn[] value(); 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/annotation/CsvEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.annotation; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * 区切り文字形式のデータであることを示します。 26 | * 27 | * @author Koji Sugisawa 28 | */ 29 | @Target(ElementType.TYPE) 30 | @Retention(RetentionPolicy.RUNTIME) 31 | public @interface CsvEntity { 32 | 33 | /** 34 | * 区切り文字形式データの列見出し (ヘッダ) 行を使用するかどうかを返します。

35 | * 区切り文字形式データの列見出し (ヘッダ) 行を使用しないとした場合、先頭行は列見出し (ヘッダ) 行ではなくデータ行として処理されます。 36 | * 37 | * @return 区切り文字形式データの列見出し (ヘッダ) 行を使用するかどうか 38 | */ 39 | boolean header() default true; 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/annotation/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Java プログラム要素から区切り文字形式データを使用するための注釈を定義します。 19 | * 20 | *

21 |  * 例:
22 |  * 
23 |  * @CsvEntity(header = true)
24 |  * public class Price {
25 |  *
26 |  *     @CsvColumn(position = 0, name = "シンボル")
27 |  *     String symbol;
28 |  *
29 |  *     @CsvColumn(position = 1, name = "名称")
30 |  *     String name;
31 |  *
32 |  *     @CsvColumns({
33 |  *         @CsvColumn(position = 7, name = "日付", format = "yyyy/MM/dd"),
34 |  *         @CsvColumn(position = 8, name = "時刻", format = "HH:mm:ss")
35 |  *     })
36 |  *     Date date;
37 |  *
38 |  *     @CsvColumn(position = 2, name = "始値")
39 |  *     Number open;
40 |  *
41 |  *     @CsvColumn(position = 3, name = "高値")
42 |  *     Number high;
43 |  *
44 |  *     @CsvColumn(position = 4, name = "安値")
45 |  *     Number low;
46 |  *
47 |  *     @CsvColumn(position = 5, name = "終値")
48 |  *     Number close;
49 |  *
50 |  *     @CsvColumn(position = 6, name = "出来高")
51 |  *     Number volume;
52 |  *
53 |  * }
54 |  * 
55 | * 56 | * @author Koji Sugisawa 57 | */ 58 | package com.orangesignal.csv.annotation; -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/bean/CsvBeanOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.bean; 18 | 19 | import com.orangesignal.csv.filters.CsvNamedValueFilter; 20 | 21 | /** 22 | * Java プログラム要素と区切り文字形式データアクセス操作のインタフェースを提供します。 23 | * 24 | * @param Java プログラム要素と区切り文字形式データアクセス操作クラスの型 25 | * @author Koji Sugisawa 26 | * @since 1.4.0 27 | */ 28 | public interface CsvBeanOperation { 29 | 30 | /** 31 | * Java プログラム要素へデータを設定する名前群を設定します。 32 | * 33 | * @param names Java プログラム要素へデータを設定する名前群 34 | * @return このオブジェクトへの参照 35 | * @throws IllegalArgumentException Java プログラム要素へデータを設定しない名前群が存在する場合 36 | */ 37 | H includes(String... names); 38 | 39 | /** 40 | * Java プログラム要素へデータを設定しない名前群を設定します。 41 | * 42 | * @param names Java プログラム要素へデータを設定しない名前群 43 | * @return このオブジェクトへの参照 44 | * @throws IllegalArgumentException Java プログラム要素へデータを設定する名前群が存在する場合 45 | */ 46 | H excludes(String... names); 47 | 48 | /** 49 | * 区切り文字形式データフィルタを設定します。 50 | * 51 | * @param filter 区切り文字形式データフィルタ 52 | * @return このオブジェクトへの参照 53 | */ 54 | H filter(CsvNamedValueFilter filter); 55 | 56 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/bean/CsvEntityOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.bean; 18 | 19 | import com.orangesignal.csv.filters.CsvNamedValueFilter; 20 | 21 | /** 22 | * 区切り文字形式データ注釈要素 {@link com.orangesignal.csv.annotation.CsvEntity} で注釈付けされた Java プログラム要素と区切り文字形式データアクセス操作のインタフェースを提供します。 23 | * 24 | * @param Java プログラム要素と区切り文字形式データアクセス操作クラスの型 25 | * @author Koji Sugisawa 26 | * @since 1.4.0 27 | */ 28 | public interface CsvEntityOperation { 29 | 30 | /** 31 | * 区切り文字形式データフィルタを設定します。 32 | * 33 | * @param filter 区切り文字形式データフィルタ 34 | * @return このオブジェクトへの参照 35 | */ 36 | H filter(CsvNamedValueFilter filter); 37 | 38 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/bean/CsvValueConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.bean; 18 | 19 | /** 20 | * オブジェクトと文字列を変換する区切り文字形式データの項目値変換インターフェースです。 21 | * 22 | * @author Koji Sugisawa 23 | */ 24 | public interface CsvValueConverter { 25 | 26 | /** 27 | * 指定された文字列を指定された型のオブジェクトへ変換して返します。

28 | * 指定された文字列が {@code null} や空文字列の場合に、どのような値が返されるかは実装に依存します。 29 | * 30 | * @param str 変換する文字列 31 | * @param type 変換する型 32 | * @return 変換されたオブジェクト 33 | * @throws IllegalArgumentException 変換に失敗した場合 34 | */ 35 | Object convert(String str, Class type); 36 | 37 | /** 38 | * 指定されたオブジェクトを文字列へ変換して返します。 39 | * 40 | * @param value 変換するオブジェクト 41 | * @return 変換された文字列 42 | * @throws IllegalArgumentException 変換に失敗した場合 43 | */ 44 | String convert(Object value); 45 | 46 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/bean/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Java プログラム要素と区切り文字形式データアクセスのためのヘルパークラスやユーティリティなどを提供します。 19 | * 20 | * @author Koji Sugisawa 21 | * @since 1.4.0 22 | */ 23 | package com.orangesignal.csv.bean; -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/entryfilters/AbstractEntryFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entryfilters; 18 | 19 | import java.io.Serializable; 20 | 21 | import com.orangesignal.csv.LhaEntryFilter; 22 | import com.orangesignal.csv.ZipEntryFilter; 23 | 24 | /** 25 | * エントリフィルタの基底クラスを提供します。 26 | * 27 | * @author Koji Sugisawa 28 | * @since 1.2.2 29 | */ 30 | public abstract class AbstractEntryFilter implements ZipEntryFilter, LhaEntryFilter, Serializable { 31 | 32 | private static final long serialVersionUID = -1492900359515513779L; 33 | 34 | /** 35 | * デフォルトコンストラクタです。 36 | */ 37 | protected AbstractEntryFilter() { 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | final String name = getClass().getName(); 43 | final int period = name.lastIndexOf('.'); 44 | return period > 0 ? name.substring(period + 1) : name; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/entryfilters/DirectoryEntryFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entryfilters; 18 | 19 | import java.util.zip.ZipEntry; 20 | 21 | import com.orangesignal.jlha.LhaHeader; 22 | 23 | /** 24 | * ディレクトリエントリをフィルタするエントリフィルタの実装です。 25 | * ディレクトリエントリはエントリ名の後ろがスラッシュ「/」となっているエントリです。 26 | * 27 | * @author Koji Sugisawa 28 | */ 29 | public class DirectoryEntryFilter extends AbstractEntryFilter { 30 | 31 | private static final long serialVersionUID = 7352823190771258451L; 32 | 33 | /** 34 | * デフォルトコンストラクタです。 35 | */ 36 | public DirectoryEntryFilter() { 37 | } 38 | 39 | /** 40 | * 指定された ZIP エントリをテストし、エントリがディレクトリエントリの場合は {@code false} そうでない場合は {@code true} を返します。 41 | * 42 | * @param entry テストする ZIP エントリ 43 | * @return エントリがディレクトリエントリの場合は {@code false}、そうでない場合は {@code true} 44 | */ 45 | @Override 46 | public boolean accept(final ZipEntry entry) { 47 | return !entry.isDirectory(); 48 | } 49 | 50 | /** 51 | * 指定された LHA エントリをテストし、エントリがディレクトリエントリの場合は {@code false} そうでない場合は {@code true} を返します。 52 | * 53 | * @param entry テストする LHA エントリ 54 | * @return エントリがディレクトリエントリの場合は {@code false}、そうでない場合は {@code true} 55 | */ 56 | @Override 57 | public boolean accept(final LhaHeader entry) { 58 | return !entry.getPath().endsWith("/"); 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/entryfilters/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 圧縮形式データのエントリフィルタの実装クラスを提供します。 19 | * 20 | * @author Koji Sugisawa 21 | */ 22 | package com.orangesignal.csv.entryfilters; -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanAndExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素フィルタ群の論理積でフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanAndExpression extends BeanLogicalExpression { 28 | 29 | /** 30 | * デフォルトコンストラクタです。 31 | */ 32 | public BeanAndExpression() { 33 | super(); 34 | } 35 | 36 | /** 37 | * コンストラクタです。 38 | * 39 | * @param filters Java プログラム要素フィルタ群 40 | * @throws IllegalArgumentException filtersnull の場合 41 | */ 42 | protected BeanAndExpression(final BeanFilter... filters) { 43 | super(filters); 44 | } 45 | 46 | @Override 47 | public boolean accept(final Object bean) throws IOException { 48 | if (filters.isEmpty()) { 49 | throw new IllegalArgumentException("Filters must not be empty"); 50 | } 51 | for (final BeanFilter filter : filters) { 52 | if (!filter.accept(bean)) { 53 | return false; 54 | } 55 | } 56 | return true; 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanEmptyExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素のフィールド値が空かどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanEmptyExpression extends BeanExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name フィールド名 33 | * @throws IllegalArgumentException namenull の場合 34 | */ 35 | protected BeanEmptyExpression(final String name) { 36 | super(name); 37 | } 38 | 39 | @Override 40 | public boolean accept(final Object bean) throws IOException { 41 | return BeanExpressionUtils.isEmpty(bean, name); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素のフィールド値が判定基準値と等しいかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanEqualExpression extends BeanCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name フィールド名 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected BeanEqualExpression(final String name, final Object criteria) { 37 | super(name, criteria); 38 | } 39 | 40 | /** 41 | * コンストラクタです。 42 | * 43 | * @param name フィールド名 44 | * @param criteria 判定基準値 45 | * @param ignoreCase 大文字と小文字を区別するかどうか 46 | * @throws IllegalArgumentException パラメータが null の場合 47 | */ 48 | protected BeanEqualExpression(final String name, final String criteria, final boolean ignoreCase) { 49 | super(name, criteria, ignoreCase); 50 | } 51 | 52 | @Override 53 | public boolean accept(final Object bean) throws IOException { 54 | return BeanExpressionUtils.eq(bean, name, criteria, ignoreCase); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | /** 20 | * 指定された Java プログラム要素のフィールド値を判定してフィルタを適用する Java プログラム要素フィルタの基底クラスを提供します。 21 | * 22 | * @author Koji Sugisawa 23 | * @since 1.2.3 24 | */ 25 | public abstract class BeanExpression implements BeanFilter { 26 | 27 | /** 28 | * フィールド名を保持します。 29 | */ 30 | protected String name; 31 | 32 | /** 33 | * コンストラクタです。 34 | * 35 | * @param name フィールド名 36 | * @throws IllegalArgumentException namenull の場合 37 | */ 38 | protected BeanExpression(final String name) { 39 | if (name == null) { 40 | throw new IllegalArgumentException("Field name must not be null"); 41 | } 42 | this.name = name; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | final String className = getClass().getName(); 48 | final int period = className.lastIndexOf('.'); 49 | return period > 0 ? className.substring(period + 1) : className; 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * Java プログラム要素フィルタのインタフェースです。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public interface BeanFilter { 28 | 29 | /** 30 | * 指定された Java プログラム要素が含まれる必要があるかどうかを判定します。 31 | * 32 | * @param bean Java プログラム要素 33 | * @return {@code bean} が含まれる必要がある場合は {@code true} 34 | * @throws IOException 35 | */ 36 | boolean accept(Object bean) throws IOException; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanGreaterThanExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | import java.util.Comparator; 21 | 22 | /** 23 | * 指定された Java プログラム要素のフィールド値が判定基準値より大きいかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 24 | * 25 | * @author Koji Sugisawa 26 | * @since 1.2.3 27 | */ 28 | public class BeanGreaterThanExpression extends BeanCriteriaExpression { 29 | 30 | /** 31 | * コンストラクタです。 32 | * 33 | * @param name フィールド名 34 | * @param criteria 判定基準値 35 | * @throws IllegalArgumentException パラメータが null の場合 36 | */ 37 | protected BeanGreaterThanExpression(final String name, final Object criteria) { 38 | super(name, criteria); 39 | } 40 | 41 | /** 42 | * コンストラクタです。 43 | * 44 | * @param name フィールド名 45 | * @param criteria 判定基準値 46 | * @param comparator コンパレータ (オプション) 47 | * @throws IllegalArgumentException パラメータが null の場合 48 | */ 49 | protected BeanGreaterThanExpression(final String name, final Object criteria, @SuppressWarnings("rawtypes") final Comparator comparator) { 50 | super(name, criteria, comparator); 51 | } 52 | 53 | @Override 54 | public boolean accept(final Object bean) throws IOException { 55 | return BeanExpressionUtils.gt(bean, name, criteria, comparator); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanGreaterThanOrEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | import java.util.Comparator; 21 | 22 | /** 23 | * 指定された Java プログラム要素のフィールド値が判定基準値以上かどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 24 | * 25 | * @author Koji Sugisawa 26 | * @since 1.2.3 27 | */ 28 | public class BeanGreaterThanOrEqualExpression extends BeanCriteriaExpression { 29 | 30 | /** 31 | * コンストラクタです。 32 | * 33 | * @param name フィールド名 34 | * @param criteria 判定基準値 35 | * @throws IllegalArgumentException パラメータが null の場合 36 | */ 37 | protected BeanGreaterThanOrEqualExpression(final String name, final Object criteria) { 38 | super(name, criteria); 39 | } 40 | 41 | /** 42 | * コンストラクタです。 43 | * 44 | * @param name フィールド名 45 | * @param criteria 判定基準値 46 | * @param comparator コンパレータ (オプション) 47 | * @throws IllegalArgumentException パラメータが null の場合 48 | */ 49 | protected BeanGreaterThanOrEqualExpression(final String name, final Object criteria, @SuppressWarnings("rawtypes") final Comparator comparator) { 50 | super(name, criteria, comparator); 51 | } 52 | 53 | @Override 54 | public boolean accept(final Object bean) throws IOException { 55 | return BeanExpressionUtils.ge(bean, name, criteria, comparator); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanInExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素のフィールド値が判定基準値群のいずれかと等しいかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanInExpression extends BeanCriteriasExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name フィールド名 33 | * @param criterias 判定基準値群 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected BeanInExpression(final String name, final Object... criterias) { 37 | super(name, criterias); 38 | } 39 | 40 | /** 41 | * コンストラクタです。 42 | * 43 | * @param name フィールド名 44 | * @param criterias 判定基準値群 45 | * @throws IllegalArgumentException パラメータが null の場合 46 | */ 47 | protected BeanInExpression(final String name, final String... criterias) { 48 | super(name, criterias); 49 | } 50 | 51 | /** 52 | * コンストラクタです。 53 | * 54 | * @param name フィールド名 55 | * @param criterias 判定基準値群 56 | * @param ignoreCase 大文字と小文字を区別するかどうか 57 | * @throws IllegalArgumentException パラメータが null の場合 58 | */ 59 | protected BeanInExpression(final String name, final String[] criterias, final boolean ignoreCase) { 60 | super(name, criterias, ignoreCase); 61 | } 62 | 63 | @Override 64 | public boolean accept(final Object bean) throws IOException { 65 | return BeanExpressionUtils.in(bean, name, criterias, ignoreCase); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanLessThanExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | import java.util.Comparator; 21 | 22 | /** 23 | * 指定された Java プログラム要素のフィールド値が判定基準値より小さいかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 24 | * 25 | * @author Koji Sugisawa 26 | * @since 1.2.3 27 | */ 28 | public class BeanLessThanExpression extends BeanCriteriaExpression { 29 | 30 | /** 31 | * コンストラクタです。 32 | * 33 | * @param name フィールド名 34 | * @param criteria 判定基準値 35 | * @throws IllegalArgumentException パラメータが null の場合 36 | */ 37 | protected BeanLessThanExpression(final String name, final Object criteria) { 38 | super(name, criteria); 39 | } 40 | 41 | /** 42 | * コンストラクタです。 43 | * 44 | * @param name フィールド名 45 | * @param criteria 判定基準値 46 | * @param comparator コンパレータ (オプション) 47 | * @throws IllegalArgumentException パラメータが null の場合 48 | */ 49 | protected BeanLessThanExpression(final String name, final Object criteria, @SuppressWarnings("rawtypes") final Comparator comparator) { 50 | super(name, criteria, comparator); 51 | } 52 | 53 | @Override 54 | public boolean accept(final Object bean) throws IOException { 55 | return BeanExpressionUtils.lt(bean, name, criteria, comparator); 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanLessThanOrEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | import java.util.Comparator; 21 | 22 | /** 23 | * 指定された Java プログラム要素のフィールド値がが判定基準値以下かどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 24 | * 25 | * @author Koji Sugisawa 26 | * @since 1.2.3 27 | */ 28 | public class BeanLessThanOrEqualExpression extends BeanCriteriaExpression { 29 | 30 | /** 31 | * コンストラクタです。 32 | * 33 | * @param name フィールド名 34 | * @param criteria 判定基準値 35 | * @throws IllegalArgumentException パラメータが null の場合 36 | */ 37 | protected BeanLessThanOrEqualExpression(final String name, final Object criteria) { 38 | super(name, criteria); 39 | } 40 | 41 | /** 42 | * コンストラクタです。 43 | * 44 | * @param name フィールド名 45 | * @param criteria 判定基準値 46 | * @param comparator コンパレータ (オプション) 47 | * @throws IllegalArgumentException パラメータが null の場合 48 | */ 49 | protected BeanLessThanOrEqualExpression(final String name, final Object criteria, @SuppressWarnings("rawtypes") final Comparator comparator) { 50 | super(name, criteria, comparator); 51 | } 52 | 53 | @Override 54 | public boolean accept(final Object bean) throws IOException { 55 | return BeanExpressionUtils.le(bean, name, criteria, comparator); 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanLogicalExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Arrays; 21 | import java.util.Collection; 22 | 23 | /** 24 | * Java プログラム要素フィルタを論理演算する Java プログラム要素フィルタの基底クラスを提供します。 25 | * 26 | * @author Koji Sugisawa 27 | * @since 1.2.3 28 | */ 29 | public abstract class BeanLogicalExpression implements BeanFilter { 30 | 31 | /** 32 | * Java プログラム要素フィルタのコレクションを保持します。 33 | */ 34 | protected final Collection filters; 35 | 36 | /** 37 | * デフォルトコンストラクタです。 38 | */ 39 | protected BeanLogicalExpression() { 40 | filters = new ArrayList(); 41 | } 42 | 43 | /** 44 | * コンストラクタです。 45 | * 46 | * @param filters Java プログラム要素フィルタ群 47 | * @throws IllegalArgumentException filtersnull の場合 48 | */ 49 | protected BeanLogicalExpression(final BeanFilter... filters) { 50 | if (filters == null) { 51 | throw new IllegalArgumentException(String.format("%s must not be null", BeanFilter.class.getSimpleName())); 52 | } 53 | this.filters = Arrays.asList(filters); 54 | } 55 | 56 | /** 57 | * 指定された Java プログラム要素フィルタを追加します。 58 | * 59 | * @param filter Java プログラム要素フィルタ 60 | */ 61 | public void add(final BeanFilter filter) { 62 | filters.add(filter); 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | final String name = getClass().getName(); 68 | final int period = name.lastIndexOf('.'); 69 | return period > 0 ? name.substring(period + 1) : name; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanNotEmptyExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素のフィールド値が空でないかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanNotEmptyExpression extends BeanExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name フィールド名 33 | * @throws IllegalArgumentException namenull の場合 34 | */ 35 | protected BeanNotEmptyExpression(final String name) { 36 | super(name); 37 | } 38 | 39 | @Override 40 | public boolean accept(final Object bean) throws IOException { 41 | return BeanExpressionUtils.isNotEmpty(bean, name); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanNotEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素のフィールド値が判定基準値と等しくないかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanNotEqualExpression extends BeanCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name フィールド名 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected BeanNotEqualExpression(final String name, final Object criteria) { 37 | super(name, criteria); 38 | } 39 | 40 | /** 41 | * コンストラクタです。 42 | * 43 | * @param name フィールド名 44 | * @param criteria 判定基準値 45 | * @param ignoreCase 大文字と小文字を区別するかどうか 46 | * @throws IllegalArgumentException パラメータが null の場合 47 | */ 48 | protected BeanNotEqualExpression(final String name, final String criteria, final boolean ignoreCase) { 49 | super(name, criteria, ignoreCase); 50 | } 51 | 52 | @Override 53 | public boolean accept(final Object bean) throws IOException { 54 | return BeanExpressionUtils.ne(bean, name, criteria, ignoreCase); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanNotExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素フィルタの論理否定でフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanNotExpression implements BeanFilter { 28 | 29 | /** 30 | * Java プログラム要素フィルタを保持します。 31 | */ 32 | private BeanFilter filter; 33 | 34 | /** 35 | * コンストラクタです。 36 | * 37 | * @param filter Java プログラム要素フィルタ 38 | * @throws IllegalArgumentException filternull の場合 39 | */ 40 | protected BeanNotExpression(final BeanFilter filter) { 41 | if (filter == null) { 42 | throw new IllegalArgumentException(String.format("%s must not be null", BeanFilter.class.getSimpleName())); 43 | } 44 | this.filter = filter; 45 | } 46 | 47 | @Override 48 | public boolean accept(final Object bean) throws IOException { 49 | return !filter.accept(bean); 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | final String name = getClass().getName(); 55 | final int period = name.lastIndexOf('.'); 56 | return period > 0 ? name.substring(period + 1) : name; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanNotInExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素のフィールド値が判定基準値群のいずれとも等しくないかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanNotInExpression extends BeanCriteriasExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name フィールド名 33 | * @param criterias 判定基準値群 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected BeanNotInExpression(final String name, final Object... criterias) { 37 | super(name, criterias); 38 | } 39 | 40 | /** 41 | * コンストラクタです。 42 | * 43 | * @param name フィールド名 44 | * @param criterias 判定基準値群 45 | * @throws IllegalArgumentException パラメータが null の場合 46 | */ 47 | protected BeanNotInExpression(final String name, final String... criterias) { 48 | super(name, criterias); 49 | } 50 | 51 | /** 52 | * コンストラクタです。 53 | * 54 | * @param name フィールド名 55 | * @param criterias 判定基準値群 56 | * @param ignoreCase 大文字と小文字を区別するかどうか 57 | * @throws IllegalArgumentException パラメータが null の場合 58 | */ 59 | protected BeanNotInExpression(final String name, final String[] criterias, final boolean ignoreCase) { 60 | super(name, criterias, ignoreCase); 61 | } 62 | 63 | @Override 64 | public boolean accept(final Object bean) throws IOException { 65 | return BeanExpressionUtils.notIn(bean, name, criterias, ignoreCase); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanNotNullExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素のフィールド値が null でないかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanNotNullExpression extends BeanExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @throws IllegalArgumentException namenull の場合 34 | */ 35 | protected BeanNotNullExpression(final String name) { 36 | super(name); 37 | } 38 | 39 | @Override 40 | public boolean accept(final Object bean) throws IOException { 41 | return BeanExpressionUtils.isNotNull(bean, name); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanNullExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素のフィールド値が null であるかどうかでフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanNullExpression extends BeanExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name フィールド名 33 | * @throws IllegalArgumentException namenull の場合 34 | */ 35 | protected BeanNullExpression(final String name) { 36 | super(name); 37 | } 38 | 39 | @Override 40 | public boolean accept(final Object bean) throws IOException { 41 | return BeanExpressionUtils.isNull(bean, name); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/BeanOrExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * 指定された Java プログラム要素フィルタ群の論理和でフィルタを適用する Java プログラム要素フィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class BeanOrExpression extends BeanLogicalExpression { 28 | 29 | /** 30 | * デフォルトコンストラクタです。 31 | */ 32 | public BeanOrExpression() { 33 | super(); 34 | } 35 | 36 | /** 37 | * コンストラクタです。 38 | * 39 | * @param filters Java プログラム要素フィルタ群 40 | * @throws IllegalArgumentException filtersnull の場合 41 | */ 42 | protected BeanOrExpression(final BeanFilter... filters) { 43 | super(filters); 44 | } 45 | 46 | @Override 47 | public boolean accept(final Object bean) throws IOException { 48 | if (filters.isEmpty()) { 49 | throw new IllegalArgumentException("Filters must not be empty"); 50 | } 51 | for (final BeanFilter filter : filters) { 52 | if (filter.accept(bean)) { 53 | return true; 54 | } 55 | } 56 | return false; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameBetweenExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が下限値から上限値の範囲かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameBetweenExpression extends ColumnNameExpression { 28 | 29 | /** 30 | * 下限値を保持します。 31 | */ 32 | private String low; 33 | 34 | /** 35 | * 上限値を保持します。 36 | */ 37 | private String high; 38 | 39 | /** 40 | * コンストラクタです。 41 | * 42 | * @param name 項目名 43 | * @param low 下限値 44 | * @param high 上限値 45 | * @throws IllegalArgumentException パラメータが null の場合 46 | */ 47 | protected ColumnNameBetweenExpression(final String name, final String low, final String high) { 48 | super(name); 49 | if (low == null || high == null) { 50 | throw new IllegalArgumentException("Low or High must not be null"); 51 | } 52 | this.low = low; 53 | this.high = high; 54 | } 55 | 56 | @Override 57 | public boolean accept(final List header, final List values) { 58 | final int position = header.indexOf(name); 59 | if (position == -1) { 60 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 61 | } 62 | return CsvExpressionUtils.between(values, position, low, high); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameCriteriaExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | /** 20 | * 指定された項目名に対応する区切り文字形式データの値を指定された判定基準値と比較してフィルタを適用する区切り文字形式データフィルタの基底クラスを提供します。 21 | * 22 | * @author Koji Sugisawa 23 | * @since 1.2.3 24 | */ 25 | public abstract class ColumnNameCriteriaExpression extends ColumnNameExpression { 26 | 27 | /** 28 | * 判定基準値を保持します。 29 | */ 30 | protected String criteria; 31 | 32 | /** 33 | * 大文字と小文字を区別するかどうかを保持します。 34 | */ 35 | protected boolean ignoreCase; 36 | 37 | /** 38 | * コンストラクタです。 39 | * 40 | * @param name 項目名 41 | * @param criteria 判定基準値 42 | * @throws IllegalArgumentException パラメータが null の場合 43 | */ 44 | protected ColumnNameCriteriaExpression(final String name, final String criteria) { 45 | this(name, criteria, false); 46 | } 47 | 48 | /** 49 | * コンストラクタです。 50 | * 51 | * @param name 項目名 52 | * @param criteria 判定基準値 53 | * @param ignoreCase 大文字と小文字を区別するかどうか 54 | * @throws IllegalArgumentException パラメータが null の場合 55 | */ 56 | protected ColumnNameCriteriaExpression(final String name, final String criteria, final boolean ignoreCase) { 57 | super(name); 58 | if (criteria == null) { 59 | throw new IllegalArgumentException("Criteria must not be null"); 60 | } 61 | this.criteria = criteria; 62 | this.ignoreCase = ignoreCase; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameEmptyExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が空かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameEmptyExpression extends ColumnNameExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @throws IllegalArgumentException namenull の場合 34 | */ 35 | protected ColumnNameEmptyExpression(final String name) { 36 | super(name); 37 | } 38 | 39 | @Override 40 | public boolean accept(final List header, final List values) { 41 | final int position = header.indexOf(name); 42 | if (position == -1) { 43 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 44 | } 45 | return CsvExpressionUtils.isEmpty(values, position); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が判定基準値と等しいかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameEqualExpression extends ColumnNameCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected ColumnNameEqualExpression(final String name, final String criteria) { 37 | super(name, criteria); 38 | } 39 | 40 | /** 41 | * コンストラクタです。 42 | * 43 | * @param name 項目名 44 | * @param criteria 判定基準値 45 | * @param ignoreCase 大文字と小文字を区別するかどうか 46 | * @throws IllegalArgumentException パラメータが null の場合 47 | */ 48 | protected ColumnNameEqualExpression(final String name, final String criteria, final boolean ignoreCase) { 49 | super(name, criteria, ignoreCase); 50 | } 51 | 52 | @Override 53 | public boolean accept(final List header, final List values) { 54 | final int position = header.indexOf(name); 55 | if (position == -1) { 56 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 57 | } 58 | return CsvExpressionUtils.eq(values, position, criteria, ignoreCase); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | /** 20 | * 指定された項目名に対応する区切り文字形式データの値を判定してフィルタを適用する区切り文字形式データフィルタの基底クラスを提供します。 21 | * 22 | * @author Koji Sugisawa 23 | * @since 1.2.3 24 | */ 25 | public abstract class ColumnNameExpression implements CsvNamedValueFilter { 26 | 27 | /** 28 | * 項目名を保持します。 29 | */ 30 | protected String name; 31 | 32 | /** 33 | * コンストラクタです。 34 | * 35 | * @param name 項目名 36 | * @throws IllegalArgumentException namenull の場合 37 | */ 38 | protected ColumnNameExpression(final String name) { 39 | if (name == null) { 40 | throw new IllegalArgumentException("Column name must not be null"); 41 | } 42 | this.name = name; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | final String className = getClass().getName(); 48 | final int period = className.lastIndexOf('.'); 49 | return period > 0 ? className.substring(period + 1) : className; 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameGreaterThanExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が判定基準値より大きいかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameGreaterThanExpression extends ColumnNameCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected ColumnNameGreaterThanExpression(final String name, final String criteria) { 37 | super(name, criteria); 38 | } 39 | 40 | @Override 41 | public boolean accept(final List header, final List values) { 42 | final int position = header.indexOf(name); 43 | if (position == -1) { 44 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 45 | } 46 | return CsvExpressionUtils.gt(values, position, criteria); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameGreaterThanOrEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が判定基準値以上かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameGreaterThanOrEqualExpression extends ColumnNameCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected ColumnNameGreaterThanOrEqualExpression(final String name, final String criteria) { 37 | super(name, criteria); 38 | } 39 | 40 | @Override 41 | public boolean accept(final List header, final List values) { 42 | final int position = header.indexOf(name); 43 | if (position == -1) { 44 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 45 | } 46 | return CsvExpressionUtils.ge(values, position, criteria); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameLessThanExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が判定基準値より小さいかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameLessThanExpression extends ColumnNameCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected ColumnNameLessThanExpression(final String name, final String criteria) { 37 | super(name, criteria); 38 | } 39 | 40 | @Override 41 | public boolean accept(final List header, final List values) { 42 | final int position = header.indexOf(name); 43 | if (position == -1) { 44 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 45 | } 46 | return CsvExpressionUtils.lt(values, position, criteria); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameLessThanOrEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が判定基準値以下かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameLessThanOrEqualExpression extends ColumnNameCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected ColumnNameLessThanOrEqualExpression(final String name, final String criteria) { 37 | super(name, criteria); 38 | } 39 | 40 | @Override 41 | public boolean accept(final List header, final List values) { 42 | final int position = header.indexOf(name); 43 | if (position == -1) { 44 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 45 | } 46 | return CsvExpressionUtils.le(values, position, criteria); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameNotEmptyExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が空でないかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameNotEmptyExpression extends ColumnNameExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @throws IllegalArgumentException namenull の場合 34 | */ 35 | protected ColumnNameNotEmptyExpression(final String name) { 36 | super(name); 37 | } 38 | 39 | @Override 40 | public boolean accept(final List header, final List values) { 41 | final int position = header.indexOf(name); 42 | if (position == -1) { 43 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 44 | } 45 | return CsvExpressionUtils.isNotEmpty(values, position); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameNotEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が判定基準値と等しくないかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameNotEqualExpression extends ColumnNameCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException パラメータが null の場合 35 | */ 36 | protected ColumnNameNotEqualExpression(final String name, final String criteria) { 37 | super(name, criteria); 38 | } 39 | 40 | /** 41 | * コンストラクタです。 42 | * 43 | * @param name 項目名 44 | * @param criteria 判定基準値 45 | * @param ignoreCase 大文字と小文字を区別するかどうか 46 | * @throws IllegalArgumentException パラメータが null の場合 47 | */ 48 | protected ColumnNameNotEqualExpression(final String name, final String criteria, final boolean ignoreCase) { 49 | super(name, criteria, ignoreCase); 50 | } 51 | 52 | @Override 53 | public boolean accept(final List header, final List values) { 54 | final int position = header.indexOf(name); 55 | if (position == -1) { 56 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 57 | } 58 | return CsvExpressionUtils.ne(values, position, criteria, ignoreCase); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameNotNullExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が null でないかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameNotNullExpression extends ColumnNameExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @throws IllegalArgumentException namenull の場合 34 | */ 35 | protected ColumnNameNotNullExpression(final String name) { 36 | super(name); 37 | } 38 | 39 | @Override 40 | public boolean accept(final List header, final List values) { 41 | final int position = header.indexOf(name); 42 | if (position == -1) { 43 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 44 | } 45 | return CsvExpressionUtils.isNotNull(values, position); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnNameNullExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目名に対応する区切り文字形式データの値が null であるかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnNameNullExpression extends ColumnNameExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param name 項目名 33 | * @throws IllegalArgumentException namenull の場合 34 | */ 35 | protected ColumnNameNullExpression(final String name) { 36 | super(name); 37 | } 38 | 39 | @Override 40 | public boolean accept(final List header, final List values) { 41 | final int position = header.indexOf(name); 42 | if (position == -1) { 43 | throw new IllegalArgumentException(String.format("Invalid column name %s", name)); 44 | } 45 | return CsvExpressionUtils.isNull(values, position); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionBetweenExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が下限値から上限値の範囲かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionBetweenExpression extends ColumnPositionExpression { 28 | 29 | /** 30 | * 下限値を保持します。 31 | */ 32 | private String low; 33 | 34 | /** 35 | * 上限値を保持します。 36 | */ 37 | private String high; 38 | 39 | /** 40 | * コンストラクタです。 41 | * 42 | * @param position 項目位置 43 | * @param low 下限値 44 | * @param high 上限値 45 | * @throws IllegalArgumentException low または highnull の場合 46 | */ 47 | protected ColumnPositionBetweenExpression(final int position, final String low, final String high) { 48 | super(position); 49 | if (low == null || high == null) { 50 | throw new IllegalArgumentException("Low or High must not be null"); 51 | } 52 | this.low = low; 53 | this.high = high; 54 | } 55 | 56 | @Override 57 | public boolean accept(final List values) { 58 | return CsvExpressionUtils.between(values, position, low, high); 59 | } 60 | 61 | @Override 62 | public boolean accept(final List header, final List values) { 63 | return CsvExpressionUtils.between(values, position, low, high); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionCriteriaExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | /** 20 | * 指定された項目位置に対応する区切り文字形式データの値を指定された判定基準値と比較してフィルタを適用する区切り文字形式データフィルタの基底クラスを提供します。 21 | * 22 | * @author Koji Sugisawa 23 | * @since 1.2.3 24 | */ 25 | public abstract class ColumnPositionCriteriaExpression extends ColumnPositionExpression { 26 | 27 | /** 28 | * 判定基準値を保持します。 29 | */ 30 | protected String criteria; 31 | 32 | /** 33 | * 大文字と小文字を区別するかどうかを保持します。 34 | */ 35 | protected boolean ignoreCase; 36 | 37 | /** 38 | * コンストラクタです。 39 | * 40 | * @param position 項目位置 41 | * @param criteria 判定基準値 42 | * @throws IllegalArgumentException criterianull の場合 43 | */ 44 | protected ColumnPositionCriteriaExpression(final int position, final String criteria) { 45 | this(position, criteria, false); 46 | } 47 | 48 | /** 49 | * コンストラクタです。 50 | * 51 | * @param position 項目位置 52 | * @param criteria 判定基準値 53 | * @param ignoreCase 大文字と小文字を区別するかどうか 54 | * @throws IllegalArgumentException criterianull の場合 55 | */ 56 | protected ColumnPositionCriteriaExpression(final int position, final String criteria, final boolean ignoreCase) { 57 | super(position); 58 | if (criteria == null) { 59 | throw new IllegalArgumentException("Criteria must not be null"); 60 | } 61 | this.criteria = criteria; 62 | this.ignoreCase = ignoreCase; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionEmptyExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が空かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionEmptyExpression extends ColumnPositionExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | */ 34 | protected ColumnPositionEmptyExpression(final int position) { 35 | super(position); 36 | } 37 | 38 | @Override 39 | public boolean accept(final List values) { 40 | return CsvExpressionUtils.isEmpty(values, position); 41 | } 42 | 43 | @Override 44 | public boolean accept(final List header, final List values) { 45 | return CsvExpressionUtils.isEmpty(values, position); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が判定基準値と等しいかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionEqualExpression extends ColumnPositionCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException criterianull の場合 35 | */ 36 | protected ColumnPositionEqualExpression(final int position, final String criteria) { 37 | super(position, criteria); 38 | } 39 | 40 | /** 41 | * コンストラクタです。 42 | * 43 | * @param position 項目位置 44 | * @param criteria 判定基準値 45 | * @param ignoreCase 大文字と小文字を区別するかどうか 46 | * @throws IllegalArgumentException criterianull の場合 47 | */ 48 | protected ColumnPositionEqualExpression(final int position, final String criteria, final boolean ignoreCase) { 49 | super(position, criteria, ignoreCase); 50 | } 51 | 52 | @Override 53 | public boolean accept(final List values) { 54 | return CsvExpressionUtils.eq(values, position, criteria, ignoreCase); 55 | } 56 | 57 | @Override 58 | public boolean accept(final List header, final List values) { 59 | return CsvExpressionUtils.eq(values, position, criteria, ignoreCase); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | /** 20 | * 指定された項目位置に対応する区切り文字形式データの値を判定してフィルタを適用する区切り文字形式データフィルタの基底クラスを提供します。 21 | * 22 | * @author Koji Sugisawa 23 | * @since 1.2.3 24 | */ 25 | public abstract class ColumnPositionExpression implements CsvValueFilter, CsvNamedValueFilter { 26 | 27 | /** 28 | * 項目位置を保持します。 29 | */ 30 | protected int position; 31 | 32 | /** 33 | * コンストラクタです。 34 | * 35 | * @param position 項目位置 36 | */ 37 | protected ColumnPositionExpression(final int position) { 38 | this.position = position; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | final String name = getClass().getName(); 44 | final int period = name.lastIndexOf('.'); 45 | return period > 0 ? name.substring(period + 1) : name; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionGreaterThanExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が判定基準値より大きいかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionGreaterThanExpression extends ColumnPositionCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException criterianull の場合 35 | */ 36 | protected ColumnPositionGreaterThanExpression(final int position, final String criteria) { 37 | super(position, criteria); 38 | } 39 | 40 | @Override 41 | public boolean accept(final List values) { 42 | return CsvExpressionUtils.gt(values, position, criteria); 43 | } 44 | 45 | @Override 46 | public boolean accept(final List header, final List values) { 47 | return CsvExpressionUtils.gt(values, position, criteria); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionGreaterThanOrEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が判定基準値以上かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionGreaterThanOrEqualExpression extends ColumnPositionCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException criterianull の場合 35 | */ 36 | protected ColumnPositionGreaterThanOrEqualExpression(final int position, final String criteria) { 37 | super(position, criteria); 38 | } 39 | 40 | @Override 41 | public boolean accept(final List values) { 42 | return CsvExpressionUtils.ge(values, position, criteria); 43 | } 44 | 45 | @Override 46 | public boolean accept(final List header, final List values) { 47 | return CsvExpressionUtils.ge(values, position, criteria); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionLessThanExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が判定基準値より小さいかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionLessThanExpression extends ColumnPositionCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException criterianull の場合 35 | */ 36 | protected ColumnPositionLessThanExpression(final int position, final String criteria) { 37 | super(position, criteria); 38 | } 39 | 40 | @Override 41 | public boolean accept(final List values) { 42 | return CsvExpressionUtils.lt(values, position, criteria); 43 | } 44 | 45 | @Override 46 | public boolean accept(final List header, final List values) { 47 | return CsvExpressionUtils.lt(values, position, criteria); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionLessThanOrEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が判定基準値以下かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionLessThanOrEqualExpression extends ColumnPositionCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException criterianull の場合 35 | */ 36 | protected ColumnPositionLessThanOrEqualExpression(final int position, final String criteria) { 37 | super(position, criteria); 38 | } 39 | 40 | @Override 41 | public boolean accept(final List values) { 42 | return CsvExpressionUtils.le(values, position, criteria); 43 | } 44 | 45 | @Override 46 | public boolean accept(final List header, final List values) { 47 | return CsvExpressionUtils.le(values, position, criteria); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionNotEmptyExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が空かどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionNotEmptyExpression extends ColumnPositionExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | */ 34 | protected ColumnPositionNotEmptyExpression(final int position) { 35 | super(position); 36 | } 37 | 38 | @Override 39 | public boolean accept(final List values) { 40 | return CsvExpressionUtils.isNotEmpty(values, position); 41 | } 42 | 43 | @Override 44 | public boolean accept(final List header, final List values) { 45 | return CsvExpressionUtils.isNotEmpty(values, position); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionNotEqualExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が判定基準値と等しくないかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionNotEqualExpression extends ColumnPositionCriteriaExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | * @param criteria 判定基準値 34 | * @throws IllegalArgumentException criterianull の場合 35 | */ 36 | protected ColumnPositionNotEqualExpression(final int position, final String criteria) { 37 | super(position, criteria); 38 | } 39 | 40 | /** 41 | * コンストラクタです。 42 | * 43 | * @param position 項目位置 44 | * @param criteria 判定基準値 45 | * @param ignoreCase 大文字と小文字を区別するかどうか 46 | * @throws IllegalArgumentException criterianull の場合 47 | */ 48 | protected ColumnPositionNotEqualExpression(final int position, final String criteria, final boolean ignoreCase) { 49 | super(position, criteria, ignoreCase); 50 | } 51 | 52 | @Override 53 | public boolean accept(final List values) { 54 | return CsvExpressionUtils.ne(values, position, criteria, ignoreCase); 55 | } 56 | 57 | @Override 58 | public boolean accept(final List header, final List values) { 59 | return CsvExpressionUtils.ne(values, position, criteria, ignoreCase); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionNotNullExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が null でないかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionNotNullExpression extends ColumnPositionExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | */ 34 | protected ColumnPositionNotNullExpression(final int position) { 35 | super(position); 36 | } 37 | 38 | @Override 39 | public boolean accept(final List values) { 40 | return CsvExpressionUtils.isNotNull(values, position); 41 | } 42 | 43 | @Override 44 | public boolean accept(final List header, final List values) { 45 | return CsvExpressionUtils.isNotNull(values, position); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/ColumnPositionNullExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された項目位置に対応する区切り文字形式データの値が null であるかどうかでフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class ColumnPositionNullExpression extends ColumnPositionExpression { 28 | 29 | /** 30 | * コンストラクタです。 31 | * 32 | * @param position 項目位置 33 | */ 34 | protected ColumnPositionNullExpression(final int position) { 35 | super(position); 36 | } 37 | 38 | @Override 39 | public boolean accept(final List values) { 40 | return CsvExpressionUtils.isNull(values, position); 41 | } 42 | 43 | @Override 44 | public boolean accept(final List header, final List values) { 45 | return CsvExpressionUtils.isNull(values, position); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvNamedValueAndExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された区切り文字形式データの項目名リストと値リストでフィルタする区切り文字形式データフィルタ群の論理積でフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class CsvNamedValueAndExpression extends CsvNamedValueLogicalExpression { 28 | 29 | /** 30 | * デフォルトコンストラクタです。 31 | */ 32 | public CsvNamedValueAndExpression() { 33 | super(); 34 | } 35 | 36 | /** 37 | * コンストラクタです。 38 | * 39 | * @param filters 区切り文字形式データフィルタ群 40 | * @throws IllegalArgumentException filtersnull の場合 41 | */ 42 | protected CsvNamedValueAndExpression(final CsvNamedValueFilter... filters) { 43 | super(filters); 44 | } 45 | 46 | @Override 47 | public boolean accept(final List header, final List values) { 48 | if (filters.isEmpty()) { 49 | throw new IllegalArgumentException("Filters must not be empty"); 50 | } 51 | for (final CsvNamedValueFilter filter : filters) { 52 | if (!filter.accept(header, values)) { 53 | return false; 54 | } 55 | } 56 | return true; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvNamedValueFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 区切り文字形式データの項目名リストと値リストでフィルタする区切り文字形式データフィルタのインタフェースです。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public interface CsvNamedValueFilter { 28 | 29 | /** 30 | * 指定された区切り文字形式データの値リストが含まれる必要があるかどうかを判定します。 31 | * 32 | * @param header 区切り文字形式データの項目名リスト 33 | * @param values 区切り文字形式データの値リスト 34 | * @return {@code values} が含まれる必要がある場合は {@code true} 35 | */ 36 | boolean accept(List header, List values); 37 | 38 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvNamedValueLogicalExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Arrays; 21 | import java.util.Collection; 22 | 23 | /** 24 | * 区切り文字形式データの項目名リストと値リストでフィルタする区切り文字形式データフィルタを論理演算する区切り文字形式データフィルタの基底クラスを提供します。 25 | * 26 | * @author Koji Sugisawa 27 | * @since 1.2.3 28 | */ 29 | public abstract class CsvNamedValueLogicalExpression implements CsvNamedValueFilter { 30 | 31 | /** 32 | * 区切り文字形式データフィルタのコレクションを保持します。 33 | */ 34 | protected final Collection filters; 35 | 36 | /** 37 | * デフォルトコンストラクタです。 38 | */ 39 | protected CsvNamedValueLogicalExpression() { 40 | filters = new ArrayList(); 41 | } 42 | 43 | /** 44 | * コンストラクタです。 45 | * 46 | * @param filters 区切り文字形式データフィルタ群 47 | * @throws IllegalArgumentException filtersnull の場合 48 | */ 49 | protected CsvNamedValueLogicalExpression(final CsvNamedValueFilter... filters) { 50 | if (filters == null) { 51 | throw new IllegalArgumentException(String.format("%s must not be null", CsvNamedValueFilter.class.getSimpleName())); 52 | } 53 | this.filters = Arrays.asList(filters); 54 | } 55 | 56 | /** 57 | * 指定された区切り文字形式データフィルタを追加します。 58 | * 59 | * @param filter 区切り文字形式データフィルタ 60 | */ 61 | public void add(final CsvNamedValueFilter filter) { 62 | filters.add(filter); 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | final String name = getClass().getName(); 68 | final int period = name.lastIndexOf('.'); 69 | return period > 0 ? name.substring(period + 1) : name; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvNamedValueNotExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された区切り文字形式データの項目名リストと値リストでフィルタする区切り文字形式データフィルタの論理否定でフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class CsvNamedValueNotExpression implements CsvNamedValueFilter { 28 | 29 | /** 30 | * 区切り文字形式データフィルタを保持します。 31 | */ 32 | private CsvNamedValueFilter filter; 33 | 34 | /** 35 | * コンストラクタです。 36 | * 37 | * @param filter 区切り文字形式データフィルタ 38 | * @throws IllegalArgumentException filternull の場合 39 | */ 40 | protected CsvNamedValueNotExpression(final CsvNamedValueFilter filter) { 41 | if (filter == null) { 42 | throw new IllegalArgumentException(String.format("%s must not be null", CsvNamedValueFilter.class.getSimpleName())); 43 | } 44 | this.filter = filter; 45 | } 46 | 47 | @Override 48 | public boolean accept(final List header, final List values) { 49 | return !filter.accept(header, values); 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | final String name = getClass().getName(); 55 | final int period = name.lastIndexOf('.'); 56 | return period > 0 ? name.substring(period + 1) : name; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvNamedValueOrExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された区切り文字形式データの項目名リストと値リストでフィルタする区切り文字形式データフィルタ群の論理和でフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class CsvNamedValueOrExpression extends CsvNamedValueLogicalExpression { 28 | 29 | /** 30 | * デフォルトコンストラクタです。 31 | */ 32 | public CsvNamedValueOrExpression() { 33 | super(); 34 | } 35 | 36 | /** 37 | * コンストラクタです。 38 | * 39 | * @param filters 区切り文字形式データフィルタ群 40 | * @throws IllegalArgumentException filtersnull の場合 41 | */ 42 | protected CsvNamedValueOrExpression(final CsvNamedValueFilter... filters) { 43 | super(filters); 44 | } 45 | 46 | @Override 47 | public boolean accept(final List header, final List values) { 48 | if (filters.isEmpty()) { 49 | throw new IllegalArgumentException("Filters must not be empty"); 50 | } 51 | for (final CsvNamedValueFilter filter : filters) { 52 | if (filter.accept(header, values)) { 53 | return true; 54 | } 55 | } 56 | return false; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvValueAndExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された区切り文字形式データの値リストでフィルタする区切り文字形式データフィルタ群の論理積でフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class CsvValueAndExpression extends CsvValueLogicalExpression { 28 | 29 | /** 30 | * デフォルトコンストラクタです。 31 | */ 32 | public CsvValueAndExpression() { 33 | super(); 34 | } 35 | 36 | /** 37 | * コンストラクタです。 38 | * 39 | * @param filters 区切り文字形式データフィルタ群 40 | * @throws IllegalArgumentException filtersnull の場合 41 | */ 42 | protected CsvValueAndExpression(final CsvValueFilter... filters) { 43 | super(filters); 44 | } 45 | 46 | @Override 47 | public boolean accept(final List values) { 48 | if (filters.isEmpty()) { 49 | throw new IllegalArgumentException("Filters must not be empty"); 50 | } 51 | for (final CsvValueFilter filter : filters) { 52 | if (!filter.accept(values)) { 53 | return false; 54 | } 55 | } 56 | return true; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvValueFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 区切り文字形式データの値リストでフィルタする区切り文字形式データフィルタのインタフェースです。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public interface CsvValueFilter { 28 | 29 | /** 30 | * 指定された区切り文字形式データの値リストが含まれる必要があるかどうかを判定します。 31 | * 32 | * @param values 区切り文字形式データの値リスト 33 | * @return {@code values} が含まれる必要がある場合は {@code true} 34 | */ 35 | boolean accept(List values); 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvValueLogicalExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Arrays; 21 | import java.util.Collection; 22 | 23 | /** 24 | * 区切り文字形式データの値リストでフィルタする区切り文字形式データフィルタを論理演算する区切り文字形式データフィルタの基底クラスを提供します。 25 | * 26 | * @author Koji Sugisawa 27 | * @since 1.2.3 28 | */ 29 | public abstract class CsvValueLogicalExpression implements CsvValueFilter { 30 | 31 | /** 32 | * 区切り文字形式データフィルタのコレクションを保持します。 33 | */ 34 | protected final Collection filters; 35 | 36 | /** 37 | * デフォルトコンストラクタです。 38 | */ 39 | protected CsvValueLogicalExpression() { 40 | filters = new ArrayList(); 41 | } 42 | 43 | /** 44 | * コンストラクタです。 45 | * 46 | * @param filters 区切り文字形式データフィルタ群 47 | * @throws IllegalArgumentException filtersnull の場合 48 | */ 49 | protected CsvValueLogicalExpression(final CsvValueFilter... filters) { 50 | if (filters == null) { 51 | throw new IllegalArgumentException(String.format("%s must not be null", CsvValueFilter.class.getSimpleName())); 52 | } 53 | this.filters = Arrays.asList(filters); 54 | } 55 | 56 | /** 57 | * 指定された区切り文字形式データフィルタを追加します。 58 | * 59 | * @param filter 区切り文字形式データフィルタ 60 | */ 61 | public void add(final CsvValueFilter filter) { 62 | filters.add(filter); 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | final String name = getClass().getName(); 68 | final int period = name.lastIndexOf('.'); 69 | return period > 0 ? name.substring(period + 1) : name; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvValueNotExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された区切り文字形式データの値リストでフィルタする区切り文字形式データフィルタの論理否定でフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class CsvValueNotExpression implements CsvValueFilter { 28 | 29 | /** 30 | * 区切り文字形式データフィルタを保持します。 31 | */ 32 | private CsvValueFilter filter; 33 | 34 | /** 35 | * コンストラクタです。 36 | * 37 | * @param filter 区切り文字形式データフィルタ 38 | * @throws IllegalArgumentException filternull の場合 39 | */ 40 | protected CsvValueNotExpression(final CsvValueFilter filter) { 41 | if (filter == null) { 42 | throw new IllegalArgumentException(String.format("%s must not be null", CsvValueFilter.class.getSimpleName())); 43 | } 44 | this.filter = filter; 45 | } 46 | 47 | @Override 48 | public boolean accept(final List values) { 49 | return !filter.accept(values); 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | final String name = getClass().getName(); 55 | final int period = name.lastIndexOf('.'); 56 | return period > 0 ? name.substring(period + 1) : name; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/CsvValueOrExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * 指定された区切り文字形式データの値リストでフィルタする区切り文字形式データフィルタ群の論理和でフィルタを適用する区切り文字形式データフィルタの実装です。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.3 26 | */ 27 | public class CsvValueOrExpression extends CsvValueLogicalExpression { 28 | 29 | /** 30 | * デフォルトコンストラクタです。 31 | */ 32 | public CsvValueOrExpression() { 33 | super(); 34 | } 35 | 36 | /** 37 | * コンストラクタです。 38 | * 39 | * @param filters 区切り文字形式データフィルタ群 40 | * @throws IllegalArgumentException filtersnull の場合 41 | */ 42 | protected CsvValueOrExpression(final CsvValueFilter... filters) { 43 | super(filters); 44 | } 45 | 46 | @Override 47 | public boolean accept(final List values) { 48 | if (filters.isEmpty()) { 49 | throw new IllegalArgumentException("Filters must not be empty"); 50 | } 51 | for (final CsvValueFilter filter : filters) { 52 | if (filter.accept(values)) { 53 | return true; 54 | } 55 | } 56 | return false; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/filters/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 区切り文字形式データフィルタと Java プログラム要素フィルタに関するインターフェースやクラスなどを提供します。 19 | * 20 | * @author Koji Sugisawa 21 | * @since 1.2.3 22 | */ 23 | package com.orangesignal.csv.filters; -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/handlers/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangesignal/orangesignal-csv/60432ca09f2fd3884f75246d4b51eb44666e8e8f/src/main/java/com/orangesignal/csv/handlers/.DS_Store -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/handlers/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 区切り文字形式データアクセスハンドラの実装クラスを提供します。 19 | * 20 | * @author Koji Sugisawa 21 | */ 22 | package com.orangesignal.csv.handlers; -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/io/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 区切り文字形式データアクセスの特定用途向けのストリームクラスを提供します。 19 | * 20 | * @author Koji Sugisawa 21 | * @since 1.4.0 22 | */ 23 | package com.orangesignal.csv.io; -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/manager/CsvBeanManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import java.util.List; 20 | 21 | import com.orangesignal.csv.CsvConfig; 22 | 23 | /** 24 | * Java プログラム要素のリストと区切り文字形式データの統合アクセスインタフェースの実装クラスを提供します。 25 | * 26 | * @author Koji Sugisawa 27 | */ 28 | public class CsvBeanManager implements CsvManager { 29 | 30 | /** 31 | * 区切り文字形式情報を保持します。 32 | */ 33 | private CsvConfig csvConfig; 34 | 35 | /** 36 | * デフォルトコンストラクタです。 37 | */ 38 | public CsvBeanManager() { 39 | this(new CsvConfig()); 40 | } 41 | 42 | /** 43 | * コンストラクタです。 44 | * 45 | * @param cfg 区切り文字形式情報 46 | * @throws IllegalArgumentException {@code cfg} が {@code null} の場合 47 | */ 48 | public CsvBeanManager(final CsvConfig cfg) { 49 | config(cfg); 50 | } 51 | 52 | @Override 53 | public CsvBeanManager config(final CsvConfig cfg) { 54 | if (cfg == null) { 55 | throw new IllegalArgumentException("CsvConfig must not be null"); 56 | } 57 | this.csvConfig = cfg; 58 | return this; 59 | } 60 | 61 | @Override 62 | public CsvBeanLoader load(final Class beanClass) { 63 | return new CsvBeanLoader(csvConfig, beanClass); 64 | } 65 | 66 | @Override 67 | public CsvBeanSaver save(final List beans, final Class beanClass) { 68 | return new CsvBeanSaver(csvConfig, beans, beanClass); 69 | } 70 | 71 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/manager/CsvColumnNameMappingBeanManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import java.util.List; 20 | 21 | import com.orangesignal.csv.CsvConfig; 22 | 23 | /** 24 | * 区切り文字形式データの項目名を基準とする Java プログラム要素のリストと区切り文字形式データの統合アクセスインタフェースの実装クラスを提供します。 25 | * 26 | * @author Koji Sugisawa 27 | * @since 1.2 28 | */ 29 | public class CsvColumnNameMappingBeanManager implements CsvManager { 30 | 31 | /** 32 | * 区切り文字形式情報を保持します。 33 | */ 34 | private CsvConfig csvConfig; 35 | 36 | /** 37 | * デフォルトコンストラクタです。 38 | */ 39 | public CsvColumnNameMappingBeanManager() { 40 | this(new CsvConfig()); 41 | } 42 | 43 | /** 44 | * コンストラクタです。 45 | * 46 | * @param cfg 区切り文字形式情報 47 | * @throws IllegalArgumentException {@code cfg} が {@code null} の場合 48 | */ 49 | public CsvColumnNameMappingBeanManager(final CsvConfig cfg) { 50 | config(cfg); 51 | } 52 | 53 | @Override 54 | public CsvColumnNameMappingBeanManager config(final CsvConfig cfg) { 55 | if (cfg == null) { 56 | throw new IllegalArgumentException("CsvConfig must not be null"); 57 | } 58 | this.csvConfig = cfg; 59 | return this; 60 | } 61 | 62 | @Override 63 | public CsvColumnNameMappingBeanLoader load(final Class beanClass) { 64 | return new CsvColumnNameMappingBeanLoader(csvConfig, beanClass); 65 | } 66 | 67 | @Override 68 | public CsvColumnNameMappingBeanSaver save(final List beans, final Class beanClass) { 69 | return new CsvColumnNameMappingBeanSaver(csvConfig, beans, beanClass); 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/manager/CsvColumnPositionMappingBeanManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import java.util.List; 20 | 21 | import com.orangesignal.csv.CsvConfig; 22 | 23 | /** 24 | * 区切り文字形式データの項目位置を基準とする Java プログラム要素のリストと区切り文字形式データの統合アクセスインタフェースの実装クラスを提供します。 25 | * 26 | * @author Koji Sugisawa 27 | * @since 1.2 28 | */ 29 | public class CsvColumnPositionMappingBeanManager implements CsvManager { 30 | 31 | /** 32 | * 区切り文字形式情報を保持します。 33 | */ 34 | private CsvConfig csvConfig; 35 | 36 | /** 37 | * デフォルトコンストラクタです。 38 | */ 39 | public CsvColumnPositionMappingBeanManager() { 40 | this(new CsvConfig()); 41 | } 42 | 43 | /** 44 | * コンストラクタです。 45 | * 46 | * @param cfg 区切り文字形式情報 47 | * @throws IllegalArgumentException {@code cfg} が {@code null} の場合 48 | */ 49 | public CsvColumnPositionMappingBeanManager(final CsvConfig cfg) { 50 | config(cfg); 51 | } 52 | 53 | @Override 54 | public CsvColumnPositionMappingBeanManager config(final CsvConfig cfg) { 55 | if (cfg == null) { 56 | throw new IllegalArgumentException("CsvConfig must not be null"); 57 | } 58 | this.csvConfig = cfg; 59 | return this; 60 | } 61 | 62 | @Override 63 | public CsvColumnPositionMappingBeanLoader load(final Class beanClass) { 64 | return new CsvColumnPositionMappingBeanLoader(csvConfig, beanClass); 65 | } 66 | 67 | @Override 68 | public CsvColumnPositionMappingBeanSaver save(final List beans, final Class beanClass) { 69 | return new CsvColumnPositionMappingBeanSaver(csvConfig, beans, beanClass); 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/manager/CsvEntityLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import com.orangesignal.csv.CsvConfig; 20 | import com.orangesignal.csv.bean.CsvEntityOperation; 21 | import com.orangesignal.csv.bean.CsvEntityTemplate; 22 | import com.orangesignal.csv.filters.CsvNamedValueFilter; 23 | import com.orangesignal.csv.handlers.CsvEntityListHandler; 24 | 25 | /** 26 | * 区切り文字形式データ注釈要素 {@link com.orangesignal.csv.annotation.CsvEntity} で注釈付けされた Java プログラム要素のリストと区切り文字形式データの統合入力インタフェースの実装クラスを提供します。 27 | * 28 | * @author Koji Sugisawa 29 | */ 30 | public class CsvEntityLoader extends AbstractCsvLoader, CsvEntityListHandler, CsvEntityLoader> implements CsvEntityOperation> { 31 | 32 | /** 33 | * コンストラクタです。 34 | * 35 | * @param cfg 区切り文字形式情報 36 | * @param entityClass Java プログラム要素の型 37 | * @throws IllegalArgumentException パラメータが不正な場合 38 | */ 39 | protected CsvEntityLoader(final CsvConfig cfg, final Class entityClass) { 40 | super(cfg, new CsvEntityListHandler(entityClass)); 41 | } 42 | 43 | @Override 44 | public CsvEntityLoader filter(final CsvNamedValueFilter filter) { 45 | getCsvListHandler().filter(filter); 46 | return this; 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/manager/CsvEntityManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import java.util.List; 20 | 21 | import com.orangesignal.csv.CsvConfig; 22 | 23 | /** 24 | * 区切り文字形式データ注釈要素 {@link com.orangesignal.csv.annotation.CsvEntity} で注釈付けされた Java プログラム要素のリストと区切り文字形式データの統合アクセスインタフェースの実装クラスを提供します。 25 | * 26 | * @author Koji Sugisawa 27 | */ 28 | public class CsvEntityManager implements CsvManager { 29 | 30 | /** 31 | * 区切り文字形式情報を保持します。 32 | */ 33 | private CsvConfig csvConfig; 34 | 35 | /** 36 | * デフォルトコンストラクタです。 37 | */ 38 | public CsvEntityManager() { 39 | this(new CsvConfig()); 40 | } 41 | 42 | /** 43 | * コンストラクタです。 44 | * 45 | * @param cfg 区切り文字形式情報 46 | * @throws IllegalArgumentException {@code cfg} が {@code null} の場合 47 | */ 48 | public CsvEntityManager(final CsvConfig cfg) { 49 | if (cfg == null) { 50 | throw new IllegalArgumentException("CsvConfig must not be null"); 51 | } 52 | this.csvConfig = cfg; 53 | } 54 | 55 | @Override 56 | public CsvEntityManager config(final CsvConfig cfg) { 57 | if (cfg == null) { 58 | throw new IllegalArgumentException("CsvConfig must not be null"); 59 | } 60 | this.csvConfig = cfg; 61 | return this; 62 | } 63 | 64 | @Override 65 | public CsvEntityLoader load(final Class entityClass) { 66 | return new CsvEntityLoader(csvConfig, entityClass); 67 | } 68 | 69 | @Override 70 | public CsvEntitySaver save(final List entities, final Class entityClass) { 71 | return new CsvEntitySaver(csvConfig, entities, entityClass); 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/manager/CsvManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import java.util.List; 20 | 21 | import com.orangesignal.csv.CsvConfig; 22 | 23 | /** 24 | * 区切り文字形式データの統合アクセスインタフェースです。 25 | * 26 | * @author Koji Sugisawa 27 | */ 28 | public interface CsvManager { 29 | 30 | /** 31 | * 区切り文字形式情報を設定します。 32 | * 33 | * @param cfg 区切り文字形式情報 34 | * @return このオブジェクトへの参照 35 | * @throws IllegalArgumentException {@code cfg} が {@code null} の場合 36 | */ 37 | CsvManager config(CsvConfig cfg); 38 | 39 | /** 40 | * 区切り文字形式データ統合入力インタフェースを構築して返します。 41 | * 42 | * @param type 区切り文字形式データの型 43 | * @return 区切り文字形式データの統合入力インタフェース 44 | * @throws IllegalArgumentException {@code type} が {@code null} または不正な場合 45 | */ 46 | CsvLoader load(Class type); 47 | 48 | /** 49 | * 区切り文字形式データ統合出力インタフェースを構築して返します。 50 | * 51 | * @param list 区切り文字形式データのリスト 52 | * @param type 区切り文字形式データの型 53 | * @return 区切り文字形式データの統合出力インタフェース 54 | * @throws IllegalArgumentException {@code list} または {@code type} が {@code null} または不正な場合 55 | */ 56 | CsvSaver save(List list, Class type); 57 | 58 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/manager/CsvManagerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import java.util.ServiceLoader; 20 | 21 | /** 22 | * アプリケーションで区切り文字形式データの統合アクセスインタフェースを取得できるファクトリ API を定義します。 23 | * 24 | * @author Koji Sugisawa 25 | */ 26 | public abstract class CsvManagerFactory { 27 | 28 | /** 29 | * デフォルトコンストラクタです。 30 | */ 31 | protected CsvManagerFactory() { 32 | } 33 | 34 | /** 35 | * {@link CsvManager} の新しいインスタンスを取得します。 36 | * この static メソッドは新しい統合アクセスインスタンスを作成します。 37 | * このメソッドは次の順序の検索手順で、ロードする {@link CsvManager} 実装クラスを決定します。 38 | *

    39 | *
  • 40 | * 可能であれば、JAR 仕様で詳細に説明されているサービス API を使用して、クラス名を判定する。 41 | * Services API は、実行時に使用できる jar 内の META-INF/services/com.orangesignal.csv.manager.CsvManager ファイルからクラス名を検索する 42 | *
  • 43 | *
  • 44 | * プラットフォームのデフォルトの {@link CsvManager} インスタンス 45 | *
  • 46 | *
47 | * 48 | * @return {@link CsvManager} の新しいインスタンス 49 | */ 50 | public static CsvManager newCsvManager() { 51 | for (final CsvManager manager : ServiceLoader.load(CsvManager.class)) { 52 | return manager; 53 | } 54 | return new CsvBeanManager(); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/manager/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 区切り文字形式データへの統合アクセスに関するインターフェースやクラスなどを提供します。 19 | * 20 | * @author Koji Sugisawa 21 | */ 22 | package com.orangesignal.csv.manager; -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/csv/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 区切り文字形式データアクセス全般に関するインターフェースやクラスなどを提供します。 19 | * 20 | * @author Koji Sugisawa 21 | */ 22 | package com.orangesignal.csv; -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/jlha/BadHuffmanTableException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2001-2002 Michel Ishizuka All rights reserved. 3 | * 4 | * 以下の条件に同意するならばソースとバイナリ形式の再配布と使用を 5 | * 変更の有無にかかわらず許可する。 6 | * 7 | * 1.ソースコードの再配布において著作権表示と この条件のリスト 8 | * および下記の声明文を保持しなくてはならない。 9 | * 10 | * 2.バイナリ形式の再配布において著作権表示と この条件のリスト 11 | * および下記の声明文を使用説明書もしくは その他の配布物内に 12 | * 含む資料に記述しなければならない。 13 | * 14 | * このソフトウェアは石塚美珠瑠によって無保証で提供され、特定の目 15 | * 的を達成できるという保証、商品価値が有るという保証にとどまらず、 16 | * いかなる明示的および暗示的な保証もしない。 17 | * 石塚美珠瑠は このソフトウェアの使用による直接的、間接的、偶発 18 | * 的、特殊な、典型的な、あるいは必然的な損害(使用によるデータの 19 | * 損失、業務の中断や見込まれていた利益の遺失、代替製品もしくは 20 | * サービスの導入費等が考えられるが、決してそれだけに限定されない 21 | * 損害)に対して、いかなる事態の原因となったとしても、契約上の責 22 | * 任や無過失責任を含む いかなる責任があろうとも、たとえそれが不 23 | * 正行為のためであったとしても、またはそのような損害の可能性が報 24 | * 告されていたとしても一切の責任を負わないものとする。 25 | */ 26 | 27 | package com.orangesignal.jlha; 28 | 29 | import java.io.IOException; 30 | 31 | /** 32 | * BlockHuffman.LenListToCodeList() 内で、 渡された LenList ( ハフマン符号長の表 )が不正なため、 ハフマン符号を生成できない事を示す。
33 | * 34 | * @author $Author: dangan $ 35 | * @version $Revision: 1.0 $ 36 | */ 37 | @SuppressWarnings("serial") 38 | public class BadHuffmanTableException extends IOException { 39 | 40 | // ------------------------------------------------------------------ 41 | // Constructor 42 | 43 | /** 44 | * 新しい BadHuffmanTableException を構築する。 45 | */ 46 | public BadHuffmanTableException() { 47 | super(); 48 | } 49 | 50 | /** 51 | * 新しい BadHuffmanTableException を構築する。 52 | * 53 | * @param message 詳細なメッセージ 54 | */ 55 | public BadHuffmanTableException(final String message) { 56 | super(message); 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/jlha/Bits.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2002 Michel Ishizuka All rights reserved. 3 | * 4 | * 以下の条件に同意するならばソースとバイナリ形式の再配布と使用を 5 | * 変更の有無にかかわらず許可する。 6 | * 7 | * 1.ソースコードの再配布において著作権表示と この条件のリスト 8 | * および下記の声明文を保持しなくてはならない。 9 | * 10 | * 2.バイナリ形式の再配布において著作権表示と この条件のリスト 11 | * および下記の声明文を使用説明書もしくは その他の配布物内に 12 | * 含む資料に記述しなければならない。 13 | * 14 | * このソフトウェアは石塚美珠瑠によって無保証で提供され、特定の目 15 | * 的を達成できるという保証、商品価値が有るという保証にとどまらず、 16 | * いかなる明示的および暗示的な保証もしない。 17 | * 石塚美珠瑠は このソフトウェアの使用による直接的、間接的、偶発 18 | * 的、特殊な、典型的な、あるいは必然的な損害(使用によるデータの 19 | * 損失、業務の中断や見込まれていた利益の遺失、代替製品もしくは 20 | * サービスの導入費等が考えられるが、決してそれだけに限定されない 21 | * 損害)に対して、いかなる事態の原因となったとしても、契約上の責 22 | * 任や無過失責任を含む いかなる責任があろうとも、たとえそれが不 23 | * 正行為のためであったとしても、またはそのような損害の可能性が報 24 | * 告されていたとしても一切の責任を負わないものとする。 25 | */ 26 | 27 | package com.orangesignal.jlha; 28 | 29 | /** 30 | * ビット処理のためのユーティリティメソッド群。 31 | * 32 | * @author $Author: dangan $ 33 | * @version $Revision: 1.0 $ 34 | */ 35 | public final class Bits { 36 | 37 | private Bits() {} 38 | 39 | /** 40 | * val のビット長を得る。 val は符号なし 32ビット整数とみなされる。 log2( (long)val & 0xFFFFFFFFL ) の戻り値の 小数点以下を切り捨てたものと同等。 41 | * 42 | * @param val 整数値 43 | * 44 | * @return val のビット長 45 | */ 46 | public static int len(int val) { 47 | int len = 0; 48 | while (0 != val) { 49 | val >>>= 1; 50 | len++; 51 | } 52 | return len; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/jlha/Disconnectable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2001-2002 Michel Ishizuka All rights reserved. 3 | * 4 | * 以下の条件に同意するならばソースとバイナリ形式の再配布と使用を 5 | * 変更の有無にかかわらず許可する。 6 | * 7 | * 1.ソースコードの再配布において著作権表示と この条件のリスト 8 | * および下記の声明文を保持しなくてはならない。 9 | * 10 | * 2.バイナリ形式の再配布において著作権表示と この条件のリスト 11 | * および下記の声明文を使用説明書もしくは その他の配布物内に 12 | * 含む資料に記述しなければならない。 13 | * 14 | * このソフトウェアは石塚美珠瑠によって無保証で提供され、特定の目 15 | * 的を達成できるという保証、商品価値が有るという保証にとどまらず、 16 | * いかなる明示的および暗示的な保証もしない。 17 | * 石塚美珠瑠は このソフトウェアの使用による直接的、間接的、偶発 18 | * 的、特殊な、典型的な、あるいは必然的な損害(使用によるデータの 19 | * 損失、業務の中断や見込まれていた利益の遺失、代替製品もしくは 20 | * サービスの導入費等が考えられるが、決してそれだけに限定されない 21 | * 損害)に対して、いかなる事態の原因となったとしても、契約上の責 22 | * 任や無過失責任を含む いかなる責任があろうとも、たとえそれが不 23 | * 正行為のためであったとしても、またはそのような損害の可能性が報 24 | * 告されていたとしても一切の責任を負わないものとする。 25 | */ 26 | 27 | package com.orangesignal.jlha; 28 | 29 | import java.io.IOException; 30 | 31 | /** 32 | * 接続を解除できるストリームのための インターフェイス。
33 | * このインターフェイスを実装するストリームは close() は disconnect() を呼ぶべきである。
34 | * 35 | * @author $Author: dangan $ 36 | * @version $Revision: 1.0 $ 37 | */ 38 | public interface Disconnectable { 39 | 40 | /** 41 | * 接続されていたストリームとの接続を解除する。 42 | * 43 | * @exception IOException 入出力エラーが発生した場合 44 | */ 45 | void disconnect() throws IOException; 46 | 47 | } -------------------------------------------------------------------------------- /src/main/java/com/orangesignal/jlha/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * OrangeSignal CSV 向けに内包させた jLHA (LHA Library for Java) のクラスやユーティリティなどを提供します。

19 | * jLHA の詳細やライセンスについては、jLHA の 20 | * 英語サイト または 21 | * 日本語サイト をご覧下さい。 22 | * 23 | * @author Koji Sugisawa 24 | * @since 2.0.0 25 | */ 26 | package com.orangesignal.jlha; -------------------------------------------------------------------------------- /src/main/javadoc/overview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

このドキュメントは、OrangeSignal CSV の API ドキュメントです。

5 | 6 | -------------------------------------------------------------------------------- /src/site/site_ja.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 19 | 20 | 21 | org.apache.maven.skins 22 | maven-fluido-skin 23 | 1.3.1 24 | 25 | 26 | 27 | 28 | 29 | orangesignal/orangesignal-csv 30 | right 31 | gray 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | /** 20 | * @author Koji Sugisawa 21 | */ 22 | public abstract class Constants { 23 | 24 | public static final String CR = "\r"; 25 | 26 | public static final String LF = "\n"; 27 | 28 | public static final String CRLF = CR + LF; 29 | 30 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/QuotePolicyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import static org.junit.Assert.fail; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * {@link QuotePolicy} クラスの単体テストです。 25 | * 26 | * @author Koji Sugisawa 27 | */ 28 | public class QuotePolicyTest { 29 | 30 | @Test 31 | public void testValues() { 32 | final QuotePolicy[] values = QuotePolicy.values(); 33 | for (final QuotePolicy value : values) { 34 | switch (value) { 35 | case ALL: case MINIMAL: 36 | break; 37 | default: 38 | fail(); 39 | } 40 | } 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/SerializationUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import static org.hamcrest.core.IsNull.notNullValue; 20 | import static org.junit.Assert.assertThat; 21 | 22 | import org.junit.Test; 23 | 24 | import com.orangesignal.csv.entryfilters.DirectoryEntryFilter; 25 | import com.orangesignal.csv.entryfilters.EntryNameFilter; 26 | import com.orangesignal.csv.entryfilters.PrefixEntryNameFilter; 27 | import com.orangesignal.csv.entryfilters.RegexEntryNameFilter; 28 | import com.orangesignal.csv.entryfilters.SuffixEntryNameFilter; 29 | 30 | /** 31 | * {@link SerializationUtils} クラスの単体テストです。 32 | * 33 | * @author Koji Sugisawa 34 | */ 35 | public class SerializationUtilsTest { 36 | 37 | @Test 38 | public void test() { 39 | assertThat(SerializationUtils.deserialize(SerializationUtils.serialize(new CsvConfig())), notNullValue()); 40 | assertThat(SerializationUtils.deserialize(SerializationUtils.serialize(new SimpleCsvToken("a\nb\nc", 1, 3, true))), notNullValue()); 41 | assertThat(SerializationUtils.deserialize(SerializationUtils.serialize(new DirectoryEntryFilter())), notNullValue()); 42 | assertThat(SerializationUtils.deserialize(SerializationUtils.serialize(new EntryNameFilter("test"))), notNullValue()); 43 | assertThat(SerializationUtils.deserialize(SerializationUtils.serialize(new PrefixEntryNameFilter("test"))), notNullValue()); 44 | assertThat(SerializationUtils.deserialize(SerializationUtils.serialize(new RegexEntryNameFilter("^.*$"))), notNullValue()); 45 | assertThat(SerializationUtils.deserialize(SerializationUtils.serialize(new SuffixEntryNameFilter("test"))), notNullValue()); 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/SimpleCsvTokenTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv; 18 | 19 | import static org.hamcrest.core.Is.is; 20 | import static org.junit.Assert.assertThat; 21 | 22 | import org.junit.Test; 23 | 24 | /** 25 | * {@link SimpleCsvToken} クラスの単体テストです。 26 | * 27 | * @author Koji Sugisawa 28 | */ 29 | public class SimpleCsvTokenTest { 30 | 31 | @Test 32 | public void testSimpleCsvToken() { 33 | new SimpleCsvToken(); 34 | new SimpleCsvToken("a\nb\nc", 1, 3, true); 35 | } 36 | 37 | @Test 38 | public void testGetValue() { 39 | assertThat(new SimpleCsvToken("a\nb\nc", 1, 3, true).getValue(), is("a\nb\nc")); 40 | } 41 | 42 | @Test 43 | public void testGetStartLineNumber() { 44 | assertThat(new SimpleCsvToken("a\nb\nc", 1, 3, true).getStartLineNumber(), is(1)); 45 | } 46 | 47 | @Test 48 | public void testGetEndLineNumber() { 49 | assertThat(new SimpleCsvToken("a\nb\nc", 1, 3, true).getEndLineNumber(), is(3)); 50 | } 51 | 52 | @Test 53 | public void testIsEnclosed() { 54 | assertThat(new SimpleCsvToken("a\nb\nc", 1, 3, true).isEnclosed(), is(true)); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/annotation/CsvColumnExceptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.annotation; 18 | 19 | import static org.hamcrest.core.Is.is; 20 | import static org.junit.Assert.assertThat; 21 | 22 | import org.junit.Test; 23 | 24 | /** 25 | * {@link CsvColumnException} クラスの単体テストです。 26 | * 27 | * @author Koji Sugisawa 28 | * @since 2.2 29 | */ 30 | public class CsvColumnExceptionTest { 31 | 32 | @Test 33 | public void test() { 34 | final CsvColumnException e = new CsvColumnException("abcdefg", "12345"); 35 | assertThat(e.getMessage(), is("abcdefg")); 36 | assertThat(e.getObject().toString(), is("12345")); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/bean/CsvBeanTemplateTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.bean; 18 | 19 | import org.junit.Rule; 20 | import org.junit.Test; 21 | import org.junit.rules.ExpectedException; 22 | 23 | import com.orangesignal.csv.model.SampleBean; 24 | 25 | /** 26 | * {@link CsvBeanTemplate} クラスの単体テストです。 27 | * 28 | * @author Koji Sugisawa 29 | * @since 1.4.0 30 | */ 31 | public class CsvBeanTemplateTest { 32 | 33 | @Rule 34 | public ExpectedException exception = ExpectedException.none(); 35 | 36 | @Test 37 | public void testIncludesIllegalArgumentException() { 38 | exception.expect(IllegalArgumentException.class); 39 | exception.expectMessage("Only includes or excludes may be specified."); 40 | new CsvBeanTemplate(SampleBean.class).excludes("aaa").includes("bbb"); 41 | } 42 | 43 | @Test 44 | public void testExcludesIllegalArgumentException() { 45 | exception.expect(IllegalArgumentException.class); 46 | exception.expectMessage("Only includes or excludes may be specified."); 47 | new CsvBeanTemplate(SampleBean.class).includes("aaa").excludes("bbb"); 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/bean/NullCsvValueConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.bean; 18 | 19 | import com.orangesignal.csv.annotation.CsvColumn; 20 | 21 | /** 22 | * 常に {@code null} を返す項目値コンバーターの実装クラスを提供します。 23 | * 24 | * @author Koji Sugisawa 25 | * @since 1.2.2 26 | * @see CsvColumn 27 | */ 28 | public final class NullCsvValueConverter implements CsvValueConverter { 29 | 30 | /** 31 | * デフォルトコンストラクタです。 32 | */ 33 | public NullCsvValueConverter() {} 34 | 35 | /** 36 | * この実装は常に {@code null} を返します。 37 | */ 38 | @Override 39 | public Object convert(final String str, final Class type) { 40 | return null; 41 | } 42 | 43 | /** 44 | * この実装は常に {@code null} を返します。 45 | */ 46 | @Override 47 | public String convert(final Object value) { 48 | return null; 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/DefaultValuePrice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import java.util.Date; 20 | 21 | import com.orangesignal.csv.annotation.CsvColumn; 22 | import com.orangesignal.csv.annotation.CsvColumns; 23 | import com.orangesignal.csv.annotation.CsvEntity; 24 | 25 | /** 26 | * @author Koji Sugisawa 27 | */ 28 | @CsvEntity(header = true) 29 | public class DefaultValuePrice { 30 | 31 | public DefaultValuePrice() {} 32 | 33 | public DefaultValuePrice(String symbol, String name, Number price, Number volume, Date date) { 34 | this.symbol = symbol; 35 | this.name = name; 36 | this.date = date; 37 | this.price = price; 38 | this.volume = volume; 39 | } 40 | 41 | @CsvColumn(position = 0, name = "シンボル", required = true, defaultValue = "XXXX") 42 | public String symbol; 43 | 44 | @CsvColumns({ 45 | @CsvColumn(position = 4, name = "日付", format = "yyyy/MM/dd", language = "ja", country = "JP", timezone = "Asia/Tokyo", defaultValue = "2014/02/02"), 46 | @CsvColumn(position = 5, name = "時刻", format = "HH:mm:ss", language = "ja", country = "JP", timezone = "Asia/Tokyo", defaultValue = "12:00:00") 47 | }) 48 | public Date date; 49 | 50 | @CsvColumn(position = 1, name = "名称", defaultValue = "xxx") 51 | public String name; 52 | 53 | @CsvColumn(position = 2, name = "価格", format = "#,##0", language = "ja", country = "JP") 54 | public Number price; 55 | 56 | @CsvColumn(position = 3, name = "出来高") 57 | public Number volume; 58 | 59 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/IntArrayEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import com.orangesignal.csv.annotation.CsvColumn; 20 | import com.orangesignal.csv.annotation.CsvColumns; 21 | import com.orangesignal.csv.annotation.CsvEntity; 22 | 23 | /** 24 | * @author Koji Sugisawa 25 | */ 26 | @CsvEntity(header = false) 27 | public class IntArrayEntity { 28 | 29 | @CsvColumns({ 30 | @CsvColumn(position = 0), 31 | @CsvColumn(position = 1), 32 | @CsvColumn(position = 2) 33 | }) 34 | public int[] array; 35 | 36 | @CsvColumn(position = 3) 37 | public String str; 38 | 39 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/IntegerArrayEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import com.orangesignal.csv.annotation.CsvColumn; 20 | import com.orangesignal.csv.annotation.CsvColumns; 21 | import com.orangesignal.csv.annotation.CsvEntity; 22 | 23 | /** 24 | * @author Koji Sugisawa 25 | */ 26 | @CsvEntity(header = false) 27 | public class IntegerArrayEntity { 28 | 29 | @CsvColumns({ 30 | @CsvColumn(position = 0), 31 | @CsvColumn(position = 1), 32 | @CsvColumn(position = 2) 33 | }) 34 | public Integer[] array; 35 | 36 | @CsvColumn(position = 3) 37 | public String str; 38 | 39 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/Issue30.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import com.orangesignal.csv.annotation.CsvColumn; 20 | import com.orangesignal.csv.annotation.CsvEntity; 21 | 22 | /** 23 | * @author Koji Sugisawa 24 | */ 25 | @CsvEntity(header = false) 26 | public class Issue30 { 27 | 28 | @CsvColumn(position = 0) 29 | public Integer no; 30 | 31 | @CsvColumn(position = 1) 32 | public String name; 33 | 34 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/Price.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import java.util.Date; 20 | 21 | import com.orangesignal.csv.annotation.CsvColumn; 22 | import com.orangesignal.csv.annotation.CsvColumns; 23 | import com.orangesignal.csv.annotation.CsvEntity; 24 | 25 | /** 26 | * @author Koji Sugisawa 27 | */ 28 | @CsvEntity(header = true) 29 | public class Price { 30 | 31 | public Price() {} 32 | 33 | public Price(String symbol, String name, Number price, Number volume, Date date) { 34 | this.symbol = symbol; 35 | this.name = name; 36 | this.date = date; 37 | this.price = price; 38 | this.volume = volume; 39 | } 40 | 41 | @CsvColumn(position = 0, name = "シンボル") 42 | public String symbol; 43 | 44 | @CsvColumns({ 45 | @CsvColumn(position = 4, name = "日付", format = "yyyy/MM/dd", language = "ja", country = "JP", timezone = "Asia/Tokyo"), 46 | @CsvColumn(position = 5, name = "時刻", format = "HH:mm:ss", language = "ja", country = "JP", timezone = "Asia/Tokyo") 47 | }) 48 | public Date date; 49 | 50 | @CsvColumns({ @CsvColumn(position = 1, name = "名称") }) 51 | public String name; 52 | 53 | @CsvColumn(position = 2, name = "価格", format = "#,##0", language = "ja", country = "JP") 54 | public Number price; 55 | 56 | @CsvColumn(position = 3, name = "出来高") 57 | public Number volume; 58 | 59 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/Price2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import java.util.Date; 20 | 21 | import com.orangesignal.csv.annotation.CsvColumn; 22 | import com.orangesignal.csv.annotation.CsvEntity; 23 | 24 | /** 25 | * @author Koji Sugisawa 26 | */ 27 | @CsvEntity(header = true) 28 | public class Price2 { 29 | 30 | public Price2() {} 31 | 32 | public Price2(String symbol, String name, Number price, Number volume, Date date) { 33 | this.symbol = symbol; 34 | this.name = name; 35 | this.date = date; 36 | this.price = price; 37 | this.volume = volume; 38 | } 39 | 40 | public String symbol; 41 | 42 | public Date date; 43 | 44 | public String name; 45 | 46 | @CsvColumn(position = 2, name = "価格", format = "#,##0", language = "ja", country = "JP") 47 | public Number price; 48 | 49 | @CsvColumn(position = 3, name = "出来高") 50 | public Number volume; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/RequiredPrice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import java.util.Date; 20 | 21 | import com.orangesignal.csv.annotation.CsvColumn; 22 | import com.orangesignal.csv.annotation.CsvColumns; 23 | import com.orangesignal.csv.annotation.CsvEntity; 24 | 25 | /** 26 | * @author Koji Sugisawa 27 | */ 28 | @CsvEntity(header = true) 29 | public class RequiredPrice { 30 | 31 | public RequiredPrice() {} 32 | 33 | public RequiredPrice(String symbol, String name, Number price, Number volume, Date date) { 34 | this.symbol = symbol; 35 | this.name = name; 36 | this.date = date; 37 | this.price = price; 38 | this.volume = volume; 39 | } 40 | 41 | @CsvColumn(position = 0, name = "シンボル", required = true) 42 | public String symbol; 43 | 44 | @CsvColumns({ 45 | @CsvColumn(position = 4, name = "日付", format = "yyyy/MM/dd", language = "ja", country = "JP", timezone = "Asia/Tokyo", defaultValue = "2014/02/02"), 46 | @CsvColumn(position = 5, name = "時刻", format = "HH:mm:ss", language = "ja", country = "JP", timezone = "Asia/Tokyo", defaultValue = "12:00:00") 47 | }) 48 | public Date date; 49 | 50 | @CsvColumn(position = 1, name = "名称", defaultValue = "xxx") 51 | public String name; 52 | 53 | @CsvColumn(position = 2, name = "価格", format = "#,##0", language = "ja", country = "JP") 54 | public Number price; 55 | 56 | @CsvColumn(position = 3, name = "出来高") 57 | public Number volume; 58 | 59 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/StringArrayEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import com.orangesignal.csv.annotation.CsvColumn; 20 | import com.orangesignal.csv.annotation.CsvColumns; 21 | import com.orangesignal.csv.annotation.CsvEntity; 22 | 23 | /** 24 | * @author Koji Sugisawa 25 | */ 26 | @CsvEntity(header = false) 27 | public class StringArrayEntity { 28 | 29 | @CsvColumns({ 30 | @CsvColumn(position = 0), 31 | @CsvColumn(position = 1), 32 | @CsvColumn(position = 2) 33 | }) 34 | public String[] array; 35 | 36 | @CsvColumn(position = 3) 37 | public String str; 38 | 39 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/Travel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import java.util.Date; 20 | 21 | import com.orangesignal.csv.annotation.CsvColumn; 22 | import com.orangesignal.csv.annotation.CsvEntity; 23 | 24 | /** 25 | * @author Koji Sugisawa 26 | */ 27 | @CsvEntity 28 | public class Travel { 29 | 30 | @CsvColumn(name = "CODE") 31 | public String cod; 32 | 33 | @CsvColumn(name = "DATE", format = "yyyy/MM/dd") 34 | public Date date; 35 | 36 | public Travel() {} 37 | 38 | public Travel(String cod, Date date) { 39 | this.cod = cod; 40 | this.date = date; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/WritableEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import com.orangesignal.csv.annotation.CsvColumn; 20 | import com.orangesignal.csv.annotation.CsvColumnAccessType; 21 | import com.orangesignal.csv.annotation.CsvColumns; 22 | import com.orangesignal.csv.annotation.CsvEntity; 23 | 24 | /** 25 | * @author Koji Sugisawa 26 | */ 27 | @CsvEntity(header = true) 28 | public class WritableEntity { 29 | 30 | @CsvColumns({ 31 | @CsvColumn(name = "col1", access = CsvColumnAccessType.READ), 32 | @CsvColumn(name = "col2"), 33 | @CsvColumn(name = "col3") 34 | }) 35 | public String[] array; 36 | 37 | @CsvColumn(name = "col4", access = CsvColumnAccessType.READ) 38 | public String str; 39 | 40 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entity/WritableNoHeaderEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entity; 18 | 19 | import com.orangesignal.csv.annotation.CsvColumn; 20 | import com.orangesignal.csv.annotation.CsvColumnAccessType; 21 | import com.orangesignal.csv.annotation.CsvColumns; 22 | import com.orangesignal.csv.annotation.CsvEntity; 23 | 24 | /** 25 | * @author Koji Sugisawa 26 | */ 27 | @CsvEntity(header = false) 28 | public class WritableNoHeaderEntity { 29 | 30 | @CsvColumns({ 31 | @CsvColumn(name = "col1", access = CsvColumnAccessType.READ), 32 | @CsvColumn(name = "col2"), 33 | @CsvColumn(name = "col3") 34 | }) 35 | public String[] array; 36 | 37 | @CsvColumn(name = "col4", access = CsvColumnAccessType.READ) 38 | public String str; 39 | 40 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/entryfilters/DirectoryEntryFilterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.entryfilters; 18 | 19 | import static org.hamcrest.core.Is.is; 20 | import static org.junit.Assert.assertFalse; 21 | import static org.junit.Assert.assertThat; 22 | import static org.junit.Assert.assertTrue; 23 | 24 | import java.util.zip.ZipEntry; 25 | 26 | import org.junit.Test; 27 | 28 | import com.orangesignal.jlha.LhaHeader; 29 | 30 | /** 31 | * {@link DirectoryEntryFilter} の単体テストです。 32 | * 33 | * @author Koji Sugisawa 34 | */ 35 | public class DirectoryEntryFilterTest { 36 | 37 | @Test 38 | public void testAcceptZipEntry() { 39 | // Arrange 40 | final DirectoryEntryFilter filter = new DirectoryEntryFilter(); 41 | // Act + Assert 42 | assertTrue(filter.accept(new ZipEntry("foo/bar/test.csv"))); 43 | assertFalse(filter.accept(new ZipEntry("foo/bar/test/"))); 44 | } 45 | 46 | @Test 47 | public void testAcceptLhaHeader() { 48 | // Arrange 49 | final DirectoryEntryFilter filter = new DirectoryEntryFilter(); 50 | // Act + Assert 51 | assertTrue(filter.accept(new LhaHeader("foo/bar/test.csv"))); 52 | assertFalse(filter.accept(new LhaHeader("foo/bar/test/"))); 53 | } 54 | 55 | @Test 56 | public void testToString() { 57 | // Act + Assert 58 | assertThat(new DirectoryEntryFilter().toString(), is("DirectoryEntryFilter")); 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/filters/BeanNotExpressionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import static org.hamcrest.core.Is.is; 20 | import static org.junit.Assert.assertFalse; 21 | import static org.junit.Assert.assertThat; 22 | import static org.junit.Assert.assertTrue; 23 | 24 | import java.io.IOException; 25 | 26 | import org.junit.Test; 27 | 28 | /** 29 | * {@link BeanNotExpression} クラスの単体テストです。 30 | * 31 | * @author Koji Sugisawa 32 | */ 33 | public class BeanNotExpressionTest { 34 | 35 | @Test(expected = IllegalArgumentException.class) 36 | public void testBeanNotExpressionIllegalArgumentException() { 37 | new BeanNotExpression(null); 38 | } 39 | 40 | @Test 41 | public void testAccept() throws IOException { 42 | assertTrue(new BeanNotExpression( 43 | new BeanFilter() { @Override public boolean accept(final Object bean) { return false; } } 44 | ).accept(null)); 45 | assertFalse(new BeanNotExpression( 46 | new BeanFilter() { @Override public boolean accept(final Object bean) { return true; } } 47 | ).accept(null)); 48 | } 49 | 50 | @Test 51 | public void testToString() { 52 | assertThat(new BeanNotExpression(new BeanFilter() { @Override public boolean accept(final Object bean) { return false; } }).toString(), is("BeanNotExpression")); 53 | 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/filters/CsvNamedValueNotExpressionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import static org.hamcrest.core.Is.is; 20 | import static org.junit.Assert.assertFalse; 21 | import static org.junit.Assert.assertThat; 22 | import static org.junit.Assert.assertTrue; 23 | 24 | import java.util.List; 25 | 26 | import org.junit.Test; 27 | 28 | /** 29 | * {@link CsvNamedValueNotExpression} クラスの単体テストです。 30 | * 31 | * @author Koji Sugisawa 32 | */ 33 | public class CsvNamedValueNotExpressionTest { 34 | 35 | @Test(expected = IllegalArgumentException.class) 36 | public void testCsvNamedValueNotExpressionIllegalArgumentException() { 37 | new CsvNamedValueNotExpression(null); 38 | } 39 | 40 | @Test 41 | public void testAccept() { 42 | assertTrue(new CsvNamedValueNotExpression( 43 | new CsvNamedValueFilter() { @Override public boolean accept(final List header, final List values) { return false; } } 44 | ).accept(null, null)); 45 | assertFalse(new CsvNamedValueNotExpression( 46 | new CsvNamedValueFilter() { @Override public boolean accept(final List header, final List values) { return true; } } 47 | ).accept(null, null)); 48 | } 49 | 50 | @Test 51 | public void testToString() { 52 | assertThat(new CsvNamedValueNotExpression( 53 | new CsvNamedValueFilter() { @Override public boolean accept(final List header, final List values) { return false; } } 54 | ).toString(), is("CsvNamedValueNotExpression")); 55 | 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/filters/CsvValueNotExpressionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.filters; 18 | 19 | import static org.hamcrest.core.Is.is; 20 | import static org.junit.Assert.assertFalse; 21 | import static org.junit.Assert.assertThat; 22 | import static org.junit.Assert.assertTrue; 23 | 24 | import java.util.List; 25 | 26 | import org.junit.Test; 27 | 28 | /** 29 | * {@link CsvValueNotExpression} クラスの単体テストです。 30 | * 31 | * @author Koji Sugisawa 32 | */ 33 | public class CsvValueNotExpressionTest { 34 | 35 | @Test(expected = IllegalArgumentException.class) 36 | public void testCsvValueNotExpressionIllegalArgumentException() { 37 | new CsvValueNotExpression(null); 38 | } 39 | 40 | @Test 41 | public void testAccept() { 42 | assertTrue(new CsvValueNotExpression( 43 | new CsvValueFilter() { @Override public boolean accept(final List values) { return false; } } 44 | ).accept(null)); 45 | assertFalse(new CsvValueNotExpression( 46 | new CsvValueFilter() { @Override public boolean accept(final List values) { return true; } } 47 | ).accept(null)); 48 | } 49 | 50 | @Test 51 | public void testToString() { 52 | assertThat(new CsvValueNotExpression(new CsvValueFilter() { @Override public boolean accept(final List values) { return false; } }).toString(), is("CsvValueNotExpression")); 53 | 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/handlers/SampleType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.handlers; 18 | 19 | /** 20 | * @author Koji Sugisawa 21 | */ 22 | public enum SampleType { A,B,C; } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/manager/CsvBeanLoaderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import org.junit.Rule; 20 | import org.junit.Test; 21 | import org.junit.rules.ExpectedException; 22 | 23 | import com.orangesignal.csv.entity.Price; 24 | 25 | /** 26 | * {@link CsvBeanLoader} クラスの単体テストです。 27 | * 28 | * @author Koji Sugisawa 29 | */ 30 | public class CsvBeanLoaderTest { 31 | 32 | @Rule 33 | public ExpectedException exception = ExpectedException.none(); 34 | 35 | @Test 36 | public void testCsvBeanLoaderIllegalArgumentException() { 37 | exception.expect(IllegalArgumentException.class); 38 | exception.expectMessage("CsvConfig must not be null"); 39 | new CsvBeanLoader(null, Price.class); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/manager/CsvBeanSaverTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import org.junit.Rule; 20 | import org.junit.Test; 21 | import org.junit.rules.ExpectedException; 22 | 23 | import com.orangesignal.csv.entity.Price; 24 | 25 | /** 26 | * {@link CsvBeanSaver} クラスの単体テストです。 27 | * 28 | * @author Koji Sugisawa 29 | */ 30 | public class CsvBeanSaverTest { 31 | 32 | @Rule 33 | public ExpectedException exception = ExpectedException.none(); 34 | 35 | @Test 36 | public void testCsvBeanSaverIllegalArgumentException() { 37 | exception.expect(IllegalArgumentException.class); 38 | exception.expectMessage("CsvConfig must not be null"); 39 | new CsvBeanSaver(null, null, Price.class); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/manager/CsvManagerFactoryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.manager; 18 | 19 | import static org.hamcrest.core.IsInstanceOf.instanceOf; 20 | import static org.junit.Assert.assertNotNull; 21 | import static org.junit.Assert.assertThat; 22 | 23 | import org.junit.Test; 24 | 25 | /** 26 | * {@link CsvManagerFactory} クラスの単体テストです。 27 | * 28 | * @author Koji Sugisawa 29 | */ 30 | public class CsvManagerFactoryTest { 31 | 32 | @Test 33 | public void testNewCsvManager() { 34 | final CsvManager csvManager = CsvManagerFactory.newCsvManager(); 35 | assertNotNull(csvManager); 36 | assertThat(csvManager, instanceOf(CsvBeanManager.class)); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/model/Sample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.model; 18 | 19 | import com.orangesignal.csv.annotation.CsvColumn; 20 | import com.orangesignal.csv.annotation.CsvEntity; 21 | 22 | /** 23 | * @author Koji Sugisawa 24 | */ 25 | @CsvEntity 26 | public class Sample { 27 | 28 | @CsvColumn(position = 0, name = "No.") 29 | public Integer no; 30 | 31 | @CsvColumn(position = 1, name = "ラベル") 32 | public String label; 33 | 34 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/model/SampleBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.model; 18 | 19 | import java.util.Date; 20 | 21 | /** 22 | * @author Koji Sugisawa 23 | */ 24 | public final class SampleBean { 25 | 26 | public SampleBean() {} 27 | 28 | public SampleBean(String symbol, String name, Number price, Number volume, Date date) { 29 | this.symbol = symbol; 30 | this.name = name; 31 | this.date = date; 32 | this.price = price; 33 | this.volume = volume; 34 | } 35 | 36 | public String symbol; 37 | public String name; 38 | public Number price; 39 | public Number volume; 40 | public Date date; 41 | 42 | } -------------------------------------------------------------------------------- /src/test/java/com/orangesignal/csv/model/SamplePrice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orangesignal.csv.model; 18 | 19 | import java.io.Serializable; 20 | import java.util.Date; 21 | 22 | /** 23 | * @author Koji Sugisawa 24 | */ 25 | public final class SamplePrice implements Serializable { 26 | 27 | private static final long serialVersionUID = 3583832835243335107L; 28 | 29 | public SamplePrice() {} 30 | 31 | private Date date; 32 | private String name; 33 | private Number price; 34 | 35 | public Date getDate() { return date; } 36 | public void setDate(Date date) { this.date = date; } 37 | public String getName() { return name; } 38 | public void setName(String name) { this.name = name; } 39 | public Number getPrice() { return price; } 40 | public void setPrice(Number price) { this.price = price; } 41 | 42 | } -------------------------------------------------------------------------------- /src/test/resources/META-INF/services/com.orangesignal.csv.manager.CsvManager: -------------------------------------------------------------------------------- 1 | com.orangesignal.csv.manager.CsvBeanManager 2 | -------------------------------------------------------------------------------- /src/test/resources/convention.dicon: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/creator.dicon: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/customizer.dicon: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/test/resources/env.txt: -------------------------------------------------------------------------------- 1 | ct 2 | -------------------------------------------------------------------------------- /src/test/resources/env_ut.txt: -------------------------------------------------------------------------------- 1 | ut 2 | -------------------------------------------------------------------------------- /src/test/resources/jdbc.dicon: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/test/resources/ken_all.lzh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangesignal/orangesignal-csv/60432ca09f2fd3884f75246d4b51eb44666e8e8f/src/test/resources/ken_all.lzh -------------------------------------------------------------------------------- /src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 2 | log4j.appender.CONSOLE.Target=System.out 3 | log4j.appender.CONSOLE.ImmediateFlush=true 4 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.CONSOLE.layout.ConversionPattern=%-5p %d [%t] %m%n 6 | 7 | log4j.rootLogger=ERROR, CONSOLE 8 | 9 | #log4j.category.org.seasar=DEBUG, C 10 | #log4j.additivity.org.seasar=false 11 | -------------------------------------------------------------------------------- /src/test/resources/n225.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangesignal/orangesignal-csv/60432ca09f2fd3884f75246d4b51eb44666e8e8f/src/test/resources/n225.csv -------------------------------------------------------------------------------- /src/test/resources/n225.lzh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangesignal/orangesignal-csv/60432ca09f2fd3884f75246d4b51eb44666e8e8f/src/test/resources/n225.lzh -------------------------------------------------------------------------------- /src/test/resources/n225.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangesignal/orangesignal-csv/60432ca09f2fd3884f75246d4b51eb44666e8e8f/src/test/resources/n225.zip -------------------------------------------------------------------------------- /src/test/resources/s2container.dicon: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/sample.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangesignal/orangesignal-csv/60432ca09f2fd3884f75246d4b51eb44666e8e8f/src/test/resources/sample.zip -------------------------------------------------------------------------------- /src/test/resources/utf8bom.csv: -------------------------------------------------------------------------------- 1 | 佐藤,鈴木 2 | --------------------------------------------------------------------------------