Package com.opengamma.masterdb.security.hibernate.swap

Source Code of com.opengamma.masterdb.security.hibernate.swap.VarianceSwapTypeUserType

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

import com.opengamma.OpenGammaRuntimeException;
import com.opengamma.financial.security.swap.VarianceSwapType;
import com.opengamma.masterdb.security.hibernate.EnumUserType;

/**
* Hibernate user type for the {@link VarianceSwapType} enum.
*/
public class VarianceSwapTypeUserType extends EnumUserType<VarianceSwapType> {

  public VarianceSwapTypeUserType() {
    super(VarianceSwapType.class, VarianceSwapType.values());
  }

  @Override
  protected String enumToStringNoCache(VarianceSwapType value) {
    switch (value) {
      case VARIANCE:
        return "variance";
      case VEGA:
        return "vega";
      default:
        throw new OpenGammaRuntimeException("unexpected value " + value);
    }
  }
}
TOP

Related Classes of com.opengamma.masterdb.security.hibernate.swap.VarianceSwapTypeUserType

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.