Package org.butor.attrset.util

Source Code of org.butor.attrset.util.AttributesSpringBuilder

package org.butor.attrset.util;

import java.util.concurrent.TimeUnit;

import org.butor.attrset.dao.AttrSetDao;
import org.butor.attrset.util.Attributes.AttributesBuilder;
import org.butor.json.CommonRequestArgs;
import org.springframework.beans.factory.FactoryBean;

public class AttributesSpringBuilder implements FactoryBean<Attributes>{

  private Long refreshCacheSeconds;
  private String id;
  private String type;
  private AttrSetDao dao;
  private CommonRequestArgs cra;
 
  @Override
  public Attributes getObject() throws Exception {
    AttributesBuilder ab = new AttributesBuilder().setType(type).setId(id).setAttrSetDao(dao).setCommonRequestArgs(cra);
    if (refreshCacheSeconds != null) {
      ab.refreshAfter(refreshCacheSeconds, TimeUnit.SECONDS);
    }
    return ab.build();
  }

  @Override
  public Class<?> getObjectType() {
    return Attributes.class;
  }

  @Override
  public boolean isSingleton() {
    return true;
  }

  public void setRefreshCacheSeconds(Long refreshCacheSeconds) {
    this.refreshCacheSeconds = refreshCacheSeconds;
  }

  public void setId(String id) {
    this.id = id;
  }

  public void setType(String type) {
    this.type = type;
  }

  public void setDao(AttrSetDao dao) {
    this.dao = dao;
  }

  public void setCra(CommonRequestArgs cra) {
    this.cra = cra;
  }
 

}
TOP

Related Classes of org.butor.attrset.util.AttributesSpringBuilder

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.