Exemplo n.º 1
0
 /**
  * Converts to an {@link OvernightIndex}.
  *
  * <p>If this is an Overnight index, then this returns the matching {@link OvernightIndex}. If
  * not, an exception is thrown.
  *
  * @return the index
  * @throws IllegalStateException if the type is not an Overnight index type
  * @see #getType()
  */
 public OvernightIndex toOvernightIndex() {
   if (!type.isOvernight()) {
     throw new IllegalStateException("Incorrect index type, expected Overnight: " + name);
   }
   return OvernightIndex.of(indexName);
 }
Exemplo n.º 2
0
 /**
  * Converts to an {@link PriceIndex}.
  *
  * <p>If this is a price index, then this returns the matching {@link PriceIndex}. If not, an
  * exception is thrown.
  *
  * @return the index
  * @throws IllegalStateException if the type is not a price index type
  * @see #getType()
  */
 public PriceIndex toPriceIndex() {
   if (!type.isPrice()) {
     throw new IllegalStateException("Incorrect index type, expected Price: " + name);
   }
   return PriceIndex.of(indexName);
 }
Exemplo n.º 3
0
 /**
  * Checks and returns an Ibor index.
  *
  * <p>If this is an Ibor index, then this returns the matching {@link IborIndex}. If not, an
  * exception is thrown.
  *
  * @param tenor the tenor of the index
  * @return the index
  * @throws IllegalStateException if the type is not an Ibor index type
  * @see #getType()
  */
 public IborIndex toIborIndex(Tenor tenor) {
   if (!type.isIbor()) {
     throw new IllegalStateException("Incorrect index type, expected Ibor: " + name);
   }
   return IborIndex.of(indexName + tenor.normalized().toString());
 }