All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cedarsoft.gdao.spring.ServiceFactory Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
package com.cedarsoft.gdao.spring;

import com.cedarsoft.gdao.GenericDao;
import com.cedarsoft.gdao.GenericService;
import com.cedarsoft.gdao.GenericServiceManager;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.FactoryBean;

/**
 *
 */
@Deprecated
public class ServiceFactory implements FactoryBean {
  @NotNull
  private final GenericServiceManager genericServiceManager;

  @NotNull
  private final Class type;

  /**
   * Creates a new factory
   *
   * @param genericServiceManager the manager that is used to resolve the DAOs
   * @param type                  the type the dao is searched for
   */
  public ServiceFactory( @NotNull GenericServiceManager genericServiceManager, @NotNull Class type ) {
    this.genericServiceManager = genericServiceManager;
    this.type = type;
  }

  @NotNull
  public GenericDao getObject() throws Exception {
    return genericServiceManager.getService( type );
  }

  public Class getObjectType() {
    return GenericService.class;
  }

  public boolean isSingleton() {
    return true;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy