Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CsvBeanLoader |
|
| 1.0;1 |
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.text.Format; | |
20 | ||
21 | import com.orangesignal.csv.CsvConfig; | |
22 | import com.orangesignal.csv.bean.CsvBeanOperation; | |
23 | import com.orangesignal.csv.bean.CsvBeanTemplate; | |
24 | import com.orangesignal.csv.filters.CsvNamedValueFilter; | |
25 | import com.orangesignal.csv.handlers.BeanListHandler; | |
26 | ||
27 | /** | |
28 | * Java プログラム要素のリストと区切り文字形式データの統合入力インタフェースの実装クラスを提供します。 | |
29 | * | |
30 | * @author Koji Sugisawa | |
31 | */ | |
32 | 0 | public class CsvBeanLoader<T> extends AbstractCsvLoader<T, CsvBeanTemplate<T>, BeanListHandler<T>, CsvBeanLoader<T>> implements CsvBeanOperation<CsvBeanLoader<T>> { |
33 | ||
34 | /** | |
35 | * コンストラクタです。 | |
36 | * | |
37 | * @param cfg 区切り文字形式情報 | |
38 | * @param beanClass JavaBean の型 | |
39 | * @throws IllegalArgumentException パラメータが不正な場合 | |
40 | */ | |
41 | protected CsvBeanLoader(final CsvConfig cfg, final Class<T> beanClass) { | |
42 | 4 | super(cfg, new BeanListHandler<T>(beanClass)); |
43 | 3 | } |
44 | ||
45 | @Override | |
46 | public CsvBeanLoader<T> includes(final String... names) { | |
47 | 0 | getCsvListHandler().includes(names); |
48 | 0 | return this; |
49 | } | |
50 | ||
51 | @Override | |
52 | public CsvBeanLoader<T> excludes(final String... names) { | |
53 | 0 | getCsvListHandler().excludes(names); |
54 | 0 | return this; |
55 | } | |
56 | ||
57 | /** | |
58 | * 指定された Java プログラム要素のフィールドを処理するフォーマットオブジェクトを設定します。 | |
59 | * | |
60 | * @param name Java プログラム要素のフィールド名 | |
61 | * @param format フィールドを処理するフォーマットオブジェクト | |
62 | * @return このオブジェクトへの参照 | |
63 | * @since 1.2 | |
64 | */ | |
65 | public CsvBeanLoader<T> format(final String name, final Format format) { | |
66 | 3 | getCsvListHandler().format(name, format); |
67 | 3 | return this; |
68 | } | |
69 | ||
70 | @Override | |
71 | public CsvBeanLoader<T> filter(final CsvNamedValueFilter filter) { | |
72 | 3 | getCsvListHandler().filter(filter); |
73 | 3 | return this; |
74 | } | |
75 | ||
76 | } |