1 package org.apache.commons.digester3.binder; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 /** 23 * The Digester EDSL. 24 * 25 * @since 3.0 26 */ 27 public interface RulesBinder 28 { 29 30 /** 31 * Returns the context {@code ClassLoader}. 32 * 33 * @return The context {@code ClassLoader} 34 */ 35 ClassLoader getContextClassLoader(); 36 37 /** 38 * Records an error message which will be presented to the user at a later time. Unlike throwing an exception, this 39 * enable us to continue configuring the Digester and discover more errors. Uses 40 * {@link String#format(String, Object[])} to insert the arguments into the message. 41 * 42 * @param messagePattern The message string pattern 43 * @param arguments Arguments referenced by the format specifiers in the format string 44 */ 45 void addError( String messagePattern, Object... arguments ); 46 47 /** 48 * Records an exception, the full details of which will be logged, and the message of which will be presented to the 49 * user at a later time. If your Module calls something that you worry may fail, you should catch the exception and 50 * pass it into this. 51 * 52 * @param t The exception has to be recorded. 53 */ 54 void addError( Throwable t ); 55 56 /** 57 * Allows sub-modules inclusion while binding rules. 58 * 59 * @param rulesModule the sub-module has to be included. 60 */ 61 void install( RulesModule rulesModule ); 62 63 /** 64 * Allows to associate the given pattern to one or more Digester rules. 65 * 66 * @param pattern The pattern that this rule should match 67 * @return The Digester rules builder 68 */ 69 LinkedRuleBuilder forPattern( String pattern ); 70 71 }