alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (FloatLeg.java)

This example Hibernate source code file (FloatLeg.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

embeddable, euribor, floatleg, floatleg, leg, leg, libor, numberformat, rateindex, rateindex, string, string, text, tibor

The Hibernate FloatLeg.java source code

package org.hibernate.test.annotations.embedded;
import java.text.NumberFormat;
import javax.persistence.Embeddable;

/**
 * Represents floating part of Interest Rate Swap cash flows.
 */
@Embeddable
public class FloatLeg extends Leg {

	/**
	 * Possible values for the rate index.
	 */
	public enum RateIndex {
		LIBOR, EURIBOR, TIBOR}

	;

	private RateIndex rateIndex;

	/**
	 * Spread over the selected rate index (in basis points).
	 */
	private double rateSpread;

	public RateIndex getRateIndex() {
		return rateIndex;
	}

	public void setRateIndex(RateIndex rateIndex) {
		this.rateIndex = rateIndex;
	}

	public double getRateSpread() {
		return rateSpread;
	}

	public void setRateSpread(double rateSpread) {
		this.rateSpread = rateSpread;
	}

	public String toString() {
		NumberFormat format = NumberFormat.getNumberInstance();
		format.setMinimumFractionDigits( 1 );
		format.setMaximumFractionDigits( 1 );
		return "[" + getRateIndex().toString() + "+" + format.format( getRateSpread() ) + "]";
	}
}

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate FloatLeg.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.