org.hibernate.jpa.boot.internal.StandardJpaScanEnvironmentImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* 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.jpa.boot.internal;
import java.net.URL;
import java.util.Collections;
import java.util.List;
import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor;
import org.hibernate.boot.archive.scan.spi.ScanEnvironment;
/**
* Implementation of ScanEnvironment leveraging a JPA deployment descriptor.
*
* @author Steve Ebersole
*/
public class StandardJpaScanEnvironmentImpl implements ScanEnvironment {
private final PersistenceUnitDescriptor persistenceUnitDescriptor;
private final List explicitlyListedClassNames;
private final List explicitlyListedMappingFiles;
public StandardJpaScanEnvironmentImpl(PersistenceUnitDescriptor persistenceUnitDescriptor) {
this.persistenceUnitDescriptor = persistenceUnitDescriptor;
this.explicitlyListedClassNames = persistenceUnitDescriptor.getManagedClassNames() == null
? Collections.emptyList()
: persistenceUnitDescriptor.getManagedClassNames();
this.explicitlyListedMappingFiles = persistenceUnitDescriptor.getMappingFileNames() == null
? Collections.emptyList()
: persistenceUnitDescriptor.getMappingFileNames();
}
@Override
public URL getRootUrl() {
return persistenceUnitDescriptor.getPersistenceUnitRootUrl();
}
@Override
public List getNonRootUrls() {
return persistenceUnitDescriptor.getJarFileUrls();
}
@Override
public List getExplicitlyListedClassNames() {
return explicitlyListedClassNames;
}
@Override
public List getExplicitlyListedMappingFiles() {
return explicitlyListedMappingFiles;
}
}