001// Copyright 2010, 2013 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5; 016 017import java.util.List; 018 019/** 020 * Wrapper around a {@link ValidationTracker} that delegates all methods to the wrapped instance. 021 * Subclasses will often override specific methods. 022 * 023 * @since 5.2.0 024 */ 025public class ValidationTrackerWrapper implements ValidationTracker 026{ 027 private final ValidationTracker delegate; 028 029 public ValidationTrackerWrapper(ValidationTracker delegate) 030 { 031 this.delegate = delegate; 032 } 033 034 public void clear() 035 { 036 delegate.clear(); 037 } 038 039 public String getError(Field field) 040 { 041 return delegate.getError(field); 042 } 043 044 public List<String> getErrors() 045 { 046 return delegate.getErrors(); 047 } 048 049 public List<String> getUnassociatedErrors() 050 { 051 return delegate.getUnassociatedErrors(); 052 } 053 054 public boolean getHasErrors() 055 { 056 return delegate.getHasErrors(); 057 } 058 059 public String getInput(Field field) 060 { 061 return delegate.getInput(field); 062 } 063 064 public boolean inError(Field field) 065 { 066 return delegate.inError(field); 067 } 068 069 public void recordError(Field field, String errorMessage) 070 { 071 delegate.recordError(field, errorMessage); 072 } 073 074 public void recordError(String errorMessage) 075 { 076 delegate.recordError(errorMessage); 077 } 078 079 public void recordInput(Field field, String input) 080 { 081 delegate.recordInput(field, input); 082 } 083 084 /** Returns the instance to which methods are delegated. */ 085 protected ValidationTracker getDelegate() 086 { 087 return delegate; 088 } 089}