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 /** 053 * Wraps the source field and attaches an initial validation error. 054 * 055 * @param Source wrapped {@link ISOField} 056 * @param FirstError initial error attached to the field 057 */ 058 public ISOVField( ISOField Source, ISOVError FirstError ) { 059 this( Source ); 060 this.errors.addLast( FirstError ); 061 } 062 063 public boolean addISOVError(ISOVError Error) { 064 return errors.add( Error ); 065 } 066 067 public ListIterator errorListIterator() { 068 return errors.listIterator(); 069 } 070 071 /** list of errors **/ 072 protected LinkedList errors = new LinkedList( ); 073}