001/*
002 * jPOS Project [http://jpos.org]
003 * Copyright (C) 2000-2026 jPOS Software SRL
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jpos.iso;
020
021import java.util.LinkedList;
022import java.util.ListIterator;
023
024/**
025 * Wrapper class resulting from process of validating an ISOField
026 * instance. Contains details of the original field and validation-error
027 * details too. Normally in validation process when an error is detected
028 * by validator in some field, then the field is replaced by an instance
029 * of this class, containning error details.
030 * <p>Title: jPOS</p>
031 * <p>Description: Java Framework for Financial Systems</p>
032 * <p>Copyright: Copyright (c) 2000 jPOS.org.  All rights reserved.</p>
033 * <p>Company: www.jPOS.org</p>
034 * @author Jose Eduardo Leon
035 * @version 1.0
036 */
037@SuppressWarnings("unchecked")
038public class ISOVField extends ISOField implements ISOVErrorList {
039
040    private static final long serialVersionUID = -2503711799295775875L;
041
042    /**
043     * Creates the vfield.
044     * @param Source original field instance.
045     */
046    public ISOVField( ISOField Source ) {
047        super();
048        this.fieldNumber = Source.fieldNumber;
049        this.value = Source.value;
050    }
051
052    public ISOVField( ISOField Source, ISOVError FirstError ) {
053        this( Source );
054        this.errors.addLast( FirstError );
055    }
056
057    public boolean addISOVError(ISOVError Error) {
058        return errors.add( Error );
059    }
060
061    public ListIterator errorListIterator() {
062        return errors.listIterator();
063    }
064
065    /** list of errors **/
066    protected LinkedList errors = new LinkedList(  );
067}