/** * 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); }