com.zaxxer.hikari.util.ClassLoaderUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of HikariCP-java6 Show documentation
Show all versions of HikariCP-java6 Show documentation
Ultimate JDBC Connection Pool
The newest version!
/*
* Copyright (C) 2013, 2014 Brett Wooldridge
*
* Licensed 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 com.zaxxer.hikari.util;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* Methods useful for class reflection and class loading.
*
* @author Brett Wooldridge
*/
public final class ClassLoaderUtils
{
public static Set> getAllInterfaces(Class> clazz)
{
Set> interfaces = new HashSet>();
for (Class> intf : Arrays.asList(clazz.getInterfaces())) {
if (intf.getInterfaces().length > 0) {
interfaces.addAll(getAllInterfaces(intf));
}
interfaces.add(intf);
}
if (clazz.getSuperclass() != null) {
interfaces.addAll(getAllInterfaces(clazz.getSuperclass()));
}
if (clazz.isInterface()) {
interfaces.add(clazz);
}
return interfaces;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy