diff --git a/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/internal/DisabledScanner.java b/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/internal/DisabledScanner.java new file mode 100755 index 0000000000..cb8626c32f --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/internal/DisabledScanner.java @@ -0,0 +1,37 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.boot.archive.scan.internal; + +import java.util.Collections; + +import org.hibernate.boot.archive.scan.spi.ClassDescriptor; +import org.hibernate.boot.archive.scan.spi.MappingFileDescriptor; +import org.hibernate.boot.archive.scan.spi.PackageDescriptor; +import org.hibernate.boot.archive.scan.spi.ScanEnvironment; +import org.hibernate.boot.archive.scan.spi.ScanOptions; +import org.hibernate.boot.archive.scan.spi.ScanParameters; +import org.hibernate.boot.archive.scan.spi.ScanResult; +import org.hibernate.boot.archive.scan.spi.Scanner; + +/** + * Implementation of Scanner that does nothing. Used for optimizing startup + * time when metadata scanning is not needed. + * + * @author Petteri Pitkanen + */ +public class DisabledScanner implements Scanner { + private static final ScanResult emptyScanResult = new ScanResultImpl( + Collections.emptySet(), + Collections.emptySet(), + Collections.emptySet() + ); + + @Override + public ScanResult scan(final ScanEnvironment environment, final ScanOptions options, final ScanParameters parameters) { + return emptyScanResult; + } +}