com.cedarsoft.gdao.async.AsynchronousService Maven / Gradle / Ivy
package com.cedarsoft.gdao.async;
import com.cedarsoft.gdao.GenericDao;
import com.cedarsoft.gdao.GenericService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*
*/
public class AsynchronousService extends AsynchronousDao implements GenericService {
@Nullable
public R perform( @NotNull final ServiceCallback callback ) {
return asyncCallSupport.invokeNullable( new DaoAction() {
public R execute( @NotNull GenericDao dao ) {
GenericService service = ( GenericService ) dao;
return callback.perform( service );
}
} );
}
public void initializeDelegatingService( @NotNull GenericService delegatingService ) {
initializeDelegatingDao( delegatingService );
}
@Override
public void initializeDelegatingDao( @NotNull GenericDao delegatingDao ) {
if ( !( delegatingDao instanceof GenericService ) ) {
throw new IllegalArgumentException( "AsynchronousService must be initialized with an GenericService as delegating dao" );
}
super.initializeDelegatingDao( delegatingDao );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy