bbeaudreault commented on code in PR #5488: URL: https://github.com/apache/hbase/pull/5488#discussion_r1383396372
########## hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectedFunctionCache.java: ########## @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.util; + +import java.io.IOException; +import java.lang.reflect.Modifier; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import org.apache.yetus.audience.InterfaceAudience; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.hbase.thirdparty.com.google.common.reflect.ClassPath; + +/** + * Cache to hold resolved Functions generated through reflection. These can be costly to create, but + * then are much faster than typical Method.invoke calls when executing. Upon construction, finds + * all subclasses in the same package of the passed baseClass. For each found class, creates a + * lambda using + * {@link ReflectionUtils#getOneArgStaticMethodAsFunction(Class, String, Class, Class)}. These are + * added to a hashmap for fast lookup by name later. + * @param <I> the input argument type for the resolved functions + * @param <R> the return type for the resolved functions + */ +@InterfaceAudience.Private +final public class ReflectedFunctionCache<I, R> { Review Comment: I called it ReflectedFunction, because it holds Functions which were created through Reflection. Once created, I don't think it's considered reflection anymore. I will fix the ordering of `final public` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org