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 * 指定された文字列を指定された型のオブジェクトへ変換して返します。<p> 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 }