// Path: hawtio-util/src/main/java/io/hawt/util/Predicate.java
// public interface Predicate<T> {
//     boolean evaluate(T value);
// }
// 
// Path: hawtio-util/src/main/java/io/hawt/util/introspect/ClassLoaderProvider.java
// public interface ClassLoaderProvider {
// 
//     /**
//      * Returns the ClassLoader or null if one is not available
//      */
//     ClassLoader getClassLoader();
// }


import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.WeakHashMap;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import io.hawt.util.Predicate;
import io.hawt.util.ReflectionHelper;
import io.hawt.util.Strings;
import io.hawt.util.introspect.ClassLoaderProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * Copyright (C) 2013 the original author or authors.
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * 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 io.hawt.util.introspect.support;



/**
 * A helper class to scan classes on the classpath
 */
public class ClassScanner {
    private static final transient Logger LOG = LoggerFactory.getLogger(ClassScanner.class);

    // lets skip some classes which can cause ugly WARN logging when doing package scanning
    private static final String[] SKIP_CLASSES = new String[]{"org.apache.log4j.net.ZeroConfSupport"};

    private final ClassLoader[] classLoaders;

    private WeakHashMap<String, CacheValue> cache = new WeakHashMap<String, CacheValue>();
    private WeakHashMap<Package, CacheValue> packageCache = new WeakHashMap<Package, CacheValue>();
// Path: hawtio-util/src/main/java/io/hawt/util/Predicate.java
// public interface Predicate<T> {
//     boolean evaluate(T value);
// }
// 
// Path: hawtio-util/src/main/java/io/hawt/util/introspect/ClassLoaderProvider.java
// public interface ClassLoaderProvider {
// 
//     /**
//      * Returns the ClassLoader or null if one is not available
//      */
//     ClassLoader getClassLoader();
// }


// Path: hawtio-util/src/main/java/io/hawt/util/introspect/support/ClassScanner.java
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.WeakHashMap;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import io.hawt.util.Predicate;
import io.hawt.util.ReflectionHelper;
import io.hawt.util.Strings;
import io.hawt.util.introspect.ClassLoaderProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Copyright (C) 2013 the original author or authors.
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * 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 io.hawt.util.introspect.support;



/**
 * A helper class to scan classes on the classpath
 */
public class ClassScanner {
    private static final transient Logger LOG = LoggerFactory.getLogger(ClassScanner.class);

    // lets skip some classes which can cause ugly WARN logging when doing package scanning
    private static final String[] SKIP_CLASSES = new String[]{"org.apache.log4j.net.ZeroConfSupport"};

    private final ClassLoader[] classLoaders;

    private WeakHashMap<String, CacheValue> cache = new WeakHashMap<String, CacheValue>();
    private WeakHashMap<Package, CacheValue> packageCache = new WeakHashMap<Package, CacheValue>();
    private Map<String, ClassLoaderProvider> classLoaderProviderMap = new HashMap<String, ClassLoaderProvider>();