1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.rat; 20 21 import java.lang.reflect.Method; 22 import java.util.Map; 23 import java.util.SortedSet; 24 25 import org.apache.rat.analysis.IHeaderMatcher; 26 import org.apache.rat.license.ILicenseFamily; 27 28 /** 29 * Parameters that can be set by the BUILDER_PARAM ComponentType. The name of the method listed here 30 * should be the same as the name specified in the ConfigComponent. 31 */ 32 public interface BuilderParams { 33 34 /** 35 * Gets one of the contained methods by name. 36 * 37 * @param name the name of the method to get. 38 * @return the Method. 39 */ 40 default Method get(String name) { 41 try { 42 return this.getClass().getMethod(name); 43 } catch (NoSuchMethodException e) { 44 throw new ImplementationException(String.format("method '%s' is not found in %s", name, this.getClass())); 45 } catch (IllegalArgumentException e) { 46 throw new ImplementationException( 47 String.format("method '%s' in %s can not be retrieved", name, this.getClass()), e); 48 } 49 } 50 51 /** 52 * Gets a mapping of matcher names to matchers. 53 * 54 * @return the mapping of matcher names to matchers. 55 */ 56 Map<String, IHeaderMatcher> matcherMap(); 57 58 /** 59 * Gets a sorted set of registered license families. 60 * 61 * @return the sorted set of license families. 62 */ 63 SortedSet<ILicenseFamily> licenseFamilies(); 64 }