001/* 002 * Copyright 2019 Leibniz-Institut für Analytische Wissenschaften – ISAS – e.V.. 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 * http://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 de.isas.mztab2.io.validators; 017 018import java.util.Collections; 019import java.util.List; 020import uk.ac.ebi.pride.jmztab2.utils.errors.MZTabError; 021import uk.ac.ebi.pride.jmztab2.utils.parser.MZTabParserContext; 022 023/** 024 * Implementations of the refining validator are applied to the type object 025 * after the actual line parsing process, for post-hoc validation. This may 026 * happen before the actual mzTab object has been fully constructed. Implementations will therefor 027 * receive the current parser context, too. 028 * 029 * @author nilshoffmann 030 * @param <T> the type of the parsed object to validate. 031 */ 032public interface RefiningValidator<T> { 033 034 /** 035 * Validate the given object of type T, using the provided parser context to 036 * check state of not yet completely parsed and constructed mzTab hierarchy. 037 * 038 * @param t the object to validate 039 * @param parserContext the parser context 040 * @return a list of {@link MZTabError}, maybe empty. 041 */ 042 public default List<MZTabError> validateRefine(T t, MZTabParserContext parserContext) { 043 return Collections.emptyList(); 044 } 045 046}