
org.reflections.util.ConfigurationBuilder Maven / Gradle / Ivy
The newest version!
/**
* Copyright © 2013 Sven Ruppert ([email protected])
*
* 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 org.reflections.util;
import org.rapidpm.dependencies.core.logger.Logger;
import org.rapidpm.dependencies.core.logger.LoggingService;
import org.reflections.Configuration;
import org.reflections.Reflections;
import org.reflections.ReflectionsException;
import org.reflections.adapters.JavaReflectionAdapter;
import org.reflections.adapters.JavassistAdapter;
import org.reflections.adapters.MetadataAdapter;
import org.reflections.scanners.Scanner;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.scanners.TypeAnnotationsScanner;
import org.reflections.serializers.Serializer;
import org.reflections.serializers.XmlSerializer;
import repacked.com.google.common.base.Predicate;
import repacked.com.google.common.collect.ObjectArrays;
import repacked.com.google.common.util.concurrent.ThreadFactoryBuilder;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.net.URL;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
public class ConfigurationBuilder implements Configuration {
/*lazy*/ protected MetadataAdapter metadataAdapter;
@Nonnull private Set scanners;
@Nonnull private Set urls;
@Nullable private Predicate inputsFilter;
/*lazy*/ private Serializer serializer;
@Nullable private ExecutorService executorService;
@Nullable private ClassLoader[] classLoaders;
private boolean expandSuperTypes = true;
public ConfigurationBuilder() {
scanners = new HashSet<>(Arrays.asList(new TypeAnnotationsScanner() , new SubTypesScanner()));
urls = new HashSet<>();
}
@SuppressWarnings("unchecked")
public static ConfigurationBuilder build(@Nullable final Object... params) {
ConfigurationBuilder builder = new ConfigurationBuilder();
//flatten
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy