org.isda.cdm.TestPayRelativeToEnum Maven / Gradle / Ivy
package org.isda.cdm;
import com.rosetta.model.lib.annotations.RosettaEnum;
import com.rosetta.model.lib.annotations.RosettaEnumValue;
import com.rosetta.model.lib.annotations.RosettaSynonym;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.isda.cdm.TestPayRelativeToEnum;
/**
* The enumerated values to specify whether payments occur relative to the calculation period start or end date, or the reset date.
* @version test
*/
@RosettaEnum("TestPayRelativeToEnum")
public enum TestPayRelativeToEnum {
/**
* Payments will occur relative to the first day of each calculation period.
*/
@RosettaSynonym(value = "CalculationPeriodStartDate", source = "FpML_5_10")
@RosettaEnumValue(value = "CalculationPeriodStartDate")
CALCULATION_PERIOD_START_DATE("CalculationPeriodStartDate", null),
/**
* Payments will occur relative to the last day of each calculation period.
*/
@RosettaSynonym(value = "CalculationPeriodEndDate", source = "FpML_5_10")
@RosettaEnumValue(value = "CalculationPeriodEndDate")
CALCULATION_PERIOD_END_DATE("CalculationPeriodEndDate", null),
/**
* Payments will occur relative to the last Pricing Date of each Calculation Period.
*/
@RosettaSynonym(value = "LastPricingDate", source = "FpML_5_10")
@RosettaEnumValue(value = "LastPricingDate")
LAST_PRICING_DATE("LastPricingDate", null),
/**
* Payments will occur relative to the reset date.
*/
@RosettaSynonym(value = "ResetDate", source = "FpML_5_10")
@RosettaEnumValue(value = "ResetDate")
RESET_DATE("ResetDate", null),
/**
* Payments will occur relative to the valuation date.
*/
@RosettaSynonym(value = "ValuationDate", source = "FpML_5_10")
@RosettaEnumValue(value = "ValuationDate")
VALUATION_DATE("ValuationDate", null)
;
private static Map values;
static {
Map map = new ConcurrentHashMap<>();
for (TestPayRelativeToEnum instance : TestPayRelativeToEnum.values()) {
map.put(instance.toDisplayString(), instance);
}
values = Collections.unmodifiableMap(map);
}
private final String rosettaName;
private final String displayName;
TestPayRelativeToEnum(String rosettaName, String displayName) {
this.rosettaName = rosettaName;
this.displayName = displayName;
}
public static TestPayRelativeToEnum fromDisplayName(String name) {
TestPayRelativeToEnum value = values.get(name);
if (value == null) {
throw new IllegalArgumentException("No enum constant with display name \"" + name + "\".");
}
return value;
}
@Override
public String toString() {
return toDisplayString();
}
public String toDisplayString() {
return displayName != null ? displayName : rosettaName;
}
}