1 /* 2 * jDTAUS Banking SPI 3 * Copyright (C) 2005 Christian Schulte 4 * <cs@schulte.it> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * 20 */ 21 package org.jdtaus.banking.dtaus.spi; 22 23 import java.io.IOException; 24 import org.jdtaus.banking.dtaus.Header; 25 import org.jdtaus.banking.dtaus.LogicalFile; 26 27 /** 28 * Validates {@code Header} instances. 29 * <p>jDTAUS Banking SPI {@code HeaderValidator} specification to be used by implementations to validate {@code Header} 30 * instances to hold valid values.</p> 31 * 32 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 33 * @version $JDTAUS: HeaderValidator.java 8661 2012-09-27 11:29:58Z schulte $ 34 */ 35 public interface HeaderValidator 36 { 37 38 /** 39 * Checks a given {@code Header} instance to hold valid values for creating a new {@code LogicalFile}. 40 * 41 * @param header The instance to check. 42 * @param result The validation result to be used or {@code null}. 43 * 44 * @return The validation result passed in as {@code result} (maybe {@code null} if the implementation did not 45 * detect illegal values). 46 * 47 * @throws NullPointerException if {@code header} is {@code null}. 48 */ 49 IllegalHeaderException assertValidHeader( Header header, IllegalHeaderException result ); 50 51 /** 52 * Checks a given {@code Header} instance to hold valid values for updating a given {@code LogicalFile} with. 53 * 54 * @param lFile The logical file to update with {@code header}. 55 * @param header The instance to check. 56 * @param counter A currency counter reflecting the state of {@code lFile}. 57 * @param result The validation result to be used or {@code null}. 58 * 59 * @return The validation result passed in as {@code result} (maybe {@code null} if the implementation did not 60 * detect illegal values). 61 * 62 * @throws NullPointerException if either {@code lFile}, {@code header} or {@code counter} is {@code null}. 63 * @throws IOException if reading fails. 64 */ 65 IllegalHeaderException assertValidHeader( LogicalFile lFile, Header header, CurrencyCounter counter, 66 IllegalHeaderException result ) throws IOException; 67 68 }