1 /*
2 * Copyright 2012 Olivier Godineau
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * the License at http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 * License for the specific language governing permissions and limitations under
12 * the License.
13 */
14 package olg.csv.bean.getter.impl;
15
16 import olg.csv.base.Row;
17 import olg.csv.bean.getter.AbstractGetter;
18
19 /**
20 * This getter always returns the given value regardless of the row.
21 *
22 *
23 */
24 public final class ConstantGetter extends AbstractGetter {
25
26 @Override
27 protected String doGet(Row line) {
28 return this.getDefaultValue();
29 }
30
31 /**
32 * Constructor with constant value in argument.
33 *
34 * @param defaultValue
35 * the constant value to apply
36 */
37 public ConstantGetter(String defaultValue) {
38 super();
39 this.setDefaultValue(defaultValue);
40
41 }
42
43 }