1 /*
2 * Copyright 2007 Kasper B. Graversen
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 package org.supercsv.mock;
17
18 import org.supercsv.cellprocessor.CellProcessorAdaptor;
19 import org.supercsv.cellprocessor.ift.BoolCellProcessor;
20 import org.supercsv.cellprocessor.ift.CellProcessor;
21 import org.supercsv.cellprocessor.ift.DateCellProcessor;
22 import org.supercsv.cellprocessor.ift.DoubleCellProcessor;
23 import org.supercsv.cellprocessor.ift.LongCellProcessor;
24 import org.supercsv.cellprocessor.ift.StringCellProcessor;
25 import org.supercsv.util.CsvContext;
26
27 /**
28 * CellProcessor to use for unit tests that test chaining (it simply returns whatever is passed into it).
29 *
30 * @author James Bassett
31 */
32 public class IdentityTransform extends CellProcessorAdaptor implements BoolCellProcessor, DateCellProcessor,
33 DoubleCellProcessor, LongCellProcessor, StringCellProcessor {
34
35 /**
36 * Constructs a new <tt>IdentityTransform</tt> processor, which simply returns whatever is passed into it.
37 */
38 public IdentityTransform() {
39 super();
40 }
41
42 /**
43 * Constructs a new <tt>IdentityTransform</tt> processor which just calls the next processor in the chain.
44 *
45 * @param next
46 * the next processor in the chain
47 */
48 public IdentityTransform(CellProcessor next) {
49 super(next);
50 }
51
52 /**
53 * {@inheritDoc}
54 */
55 public Object execute(Object value, CsvContext context) {
56 return next.execute(value, context);
57 }
58
59 }