001package org.gwtbootstrap3.client.ui.form.validator; 002 003/* 004 * #%L 005 * GwtBootstrap3 006 * %% 007 * Copyright (C) 2015 GwtBootstrap3 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023/** 024 * Mixin for looking up validation messages. This can be replaced with your own version by using a 025 * "replace-with" statment in the gwt module file. 026 * 027 * Example: 028 * 029 * <pre> 030 * {@code 031 * <replace-with class="...CustomValidatorMessageMixin"> 032 * <when-type-is class="org.gwtbootstrap3.client.ui.form.validator.ValidatorMessageMixin" /> 033 * </replace-with> 034 * } 035 * </pre> 036 * 037 * @author Steven Jardine 038 */ 039public interface ValidatorMessageMixin { 040 041 /** 042 * Lookup the message using the supplied key. 043 * 044 * @param key the key. 045 * @return the message associated with the given key. 046 */ 047 String lookup(String key); 048 049 /** 050 * Lookup a message using the given key and replace the arguments in the given message with the supplied 051 * values. 052 * 053 * <pre> 054 * {@code 055 * Message: 056 * {1} is a {2} 057 * 058 * Call: 059 * lookup("key", "This", "test."); 060 * 061 * Returns: 062 * This is a test. 063 * } 064 * </pre> 065 * 066 * @param key the key 067 * @param msgValues the values used in the message. 068 * @return the message associated with the given key with the message values replaced. 069 */ 070 String lookup(String key, Object[] msgValues); 071 072}