1 /*
2 * Copyright 2018 Andrew Rucker Jones.
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 com.opencsv.bean;
17
18 /**
19 * Represents one entry in {@link FieldMapByPosition}.
20 * Note: This is not used in the internal structure of
21 * {@link FieldMapByPosition}, but rather when representing its contents to the
22 * outside world.
23 * @param <T> The type of the bean being converted
24 *
25 * @author Andrew Rucker Jones
26 * @since 4.2
27 */
28 public class FieldMapByPositionEntry<T> {
29
30 /** The position of the related field in the CSV input. */
31 private final int position;
32
33 /** The {@link BeanField} associated with this position. */
34 private final BeanField<T, Integer> field;
35
36 /**
37 * Initializes this entry.
38 *
39 * @param position The position from the CSV input
40 * @param field The field associated with this position
41 */
42 public FieldMapByPositionEntry(int position, BeanField<T, Integer> field) {
43 this.position = position;
44 this.field = field;
45 }
46
47 /** @return The column position with which this entry was initialized */
48 public int getPosition() {return position;}
49
50 /** @return The {@link BeanField} with which this entry was initialized */
51 public BeanField<T, Integer> getField() {return field;}
52 }