001/*
002 * Copyright 2009-2010 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.springframework.batch.item.file.transform;
017
018/**
019 * Factory interface for creating {@link FieldSet} instances.
020 * 
021 * @author Dave Syer
022 *
023 */
024public interface FieldSetFactory {
025        
026        /**
027         * Create a FieldSet with named tokens. The token values can then be
028         * retrieved either by name or by column number.
029         *
030         * @param values the token values
031         * @param names the names of the tokens
032         * @return an instance of {@link FieldSet}.
033         *
034         * @see DefaultFieldSet#readString(String)
035         */
036        FieldSet create(String[] values, String[] names);
037
038        /**
039         * Create a FieldSet with anonymous tokens. They can only be retrieved by
040         * column number.
041         *
042         * @param values the token values
043         * @return an instance of {@link FieldSet}.
044         *
045         * @see FieldSet#readString(int)
046         */
047        FieldSet create(String[] values);
048
049}