Package com.opengamma.masterdb.security.hibernate.bond

Source Code of com.opengamma.masterdb.security.hibernate.bond.YieldConventionBean

/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.masterdb.security.hibernate.bond;

import com.opengamma.OpenGammaRuntimeException;
import com.opengamma.financial.convention.yield.YieldConvention;
import com.opengamma.financial.convention.yield.YieldConventionFactory;
import com.opengamma.masterdb.security.hibernate.EnumBean;

/**
* Hibernate bean for storing the yield convention.
*/
public class YieldConventionBean extends EnumBean {

  protected YieldConventionBean() {
  }

  public YieldConventionBean(String yieldConvention) {
    super(yieldConvention);
  }

  /* package */ YieldConvention toYieldConvention() {
    final YieldConvention yieldConvention = YieldConventionFactory.INSTANCE.getYieldConvention(getName());
    if (yieldConvention == null) {
      throw new OpenGammaRuntimeException("Bad value for yieldConventionBean (" + getName() + ")");
    }
    return yieldConvention;
  }

}
TOP

Related Classes of com.opengamma.masterdb.security.hibernate.bond.YieldConventionBean

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.