本文整理匯總了Java中org.hibernate.service.spi.InjectService類的典型用法代碼示例。如果您正苦於以下問題:Java InjectService類的具體用法?Java InjectService怎麽用?Java InjectService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
InjectService類屬於org.hibernate.service.spi包,在下文中一共展示了InjectService類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: applyInjections
import org.hibernate.service.spi.InjectService; //導入依賴的package包/類
private <R extends Service> void applyInjections(R service) {
try {
for ( Method method : service.getClass().getMethods() ) {
InjectService injectService = method.getAnnotation( InjectService.class );
if ( injectService == null ) {
continue;
}
processInjection( service, method, injectService );
}
}
catch (NullPointerException e) {
log.error( "NPE injecting service deps : " + service.getClass().getName() );
}
}
示例2: processInjection
import org.hibernate.service.spi.InjectService; //導入依賴的package包/類
@SuppressWarnings({ "unchecked" })
private <T extends Service> void processInjection(T service, Method injectionMethod, InjectService injectService) {
if ( injectionMethod.getParameterTypes() == null || injectionMethod.getParameterTypes().length != 1 ) {
throw new ServiceDependencyException(
"Encountered @InjectService on method with unexpected number of parameters"
);
}
Class dependentServiceRole = injectService.serviceRole();
if ( dependentServiceRole == null || dependentServiceRole.equals( Void.class ) ) {
dependentServiceRole = injectionMethod.getParameterTypes()[0];
}
// todo : because of the use of proxies, this is no longer returning null here...
final Service dependantService = getService( dependentServiceRole );
if ( dependantService == null ) {
if ( injectService.required() ) {
throw new ServiceDependencyException(
"Dependency [" + dependentServiceRole + "] declared by service [" + service + "] not found"
);
}
}
else {
try {
injectionMethod.invoke( service, dependantService );
}
catch ( Exception e ) {
throw new ServiceDependencyException( "Cannot inject dependency service", e );
}
}
}
示例3: setJndiService
import org.hibernate.service.spi.InjectService; //導入依賴的package包/類
@InjectService( required = false )
@SuppressWarnings("UnusedDeclaration")
public void setJndiService(JndiService jndiService) {
this.jndiService = jndiService;
}
示例4: injectJdbcServices
import org.hibernate.service.spi.InjectService; //導入依賴的package包/類
/**
* Hook for service registry to be able to inject JdbcServices
*
* @param jdbcServices The JdbcServices service
*/
@InjectService
@SuppressWarnings("UnusedDeclaration")
public void injectJdbcServices(JdbcServices jdbcServices) {
this.jdbcServices = jdbcServices;
}
示例5: setEntityManagerFactory
import org.hibernate.service.spi.InjectService; //導入依賴的package包/類
@InjectService
@Override
public void setEntityManagerFactory(EntityManagerFactoryRef entityManagerFactoryRef) {
this.entityManagerFactory = entityManagerFactoryRef.getEntityManagerFactory();
}
示例6: setMetadata
import org.hibernate.service.spi.InjectService; //導入依賴的package包/類
@InjectService
@Override
public void setMetadata(MetadataRef metadataRef) {
this.metadata = metadataRef.getMetadata();
}
示例7: setSearchIntegrator
import org.hibernate.service.spi.InjectService; //導入依賴的package包/類
@InjectService
@Override
public void setSearchIntegrator(SearchFactoryReference searchFactoryRef) {
this.searchIntegrator = searchFactoryRef.getSearchIntegrator();
}