@Override public String getIdentifier() { return getLabel(); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -868509005: // xValueType return ((SimpleSurfaceParameterMetadata) bean).getXValueType(); case -777049127: // xValue return ((SimpleSurfaceParameterMetadata) bean).getXValue(); case -1065022510: // yValueType return ((SimpleSurfaceParameterMetadata) bean).getYValueType(); case -748419976: // yValue return ((SimpleSurfaceParameterMetadata) bean).getYValue(); } return super.propertyGet(bean, propertyName, quiet); }
@Override public SimpleSurfaceParameterMetadata build() { return new SimpleSurfaceParameterMetadata( xValueType, xValue, yValueType, yValue); }
public void test_of() { SimpleSurfaceParameterMetadata test = SimpleSurfaceParameterMetadata.of( ValueType.YEAR_FRACTION, 1d, ValueType.STRIKE, 3d); assertEquals(test.getXValueType(), ValueType.YEAR_FRACTION); assertEquals(test.getXValue(), 1d); assertEquals(test.getYValueType(), ValueType.STRIKE); assertEquals(test.getYValue(), 3d); assertEquals(test.getLabel(), "YearFraction=1.0, Strike=3.0"); assertEquals(test.getIdentifier(), "YearFraction=1.0, Strike=3.0"); }
public void test_serialization() { SimpleSurfaceParameterMetadata test = SimpleSurfaceParameterMetadata.of( ValueType.YEAR_FRACTION, 1d, ValueType.STRIKE, 3d); assertSerialization(test); }
public void coverage() { SimpleSurfaceParameterMetadata test = SimpleSurfaceParameterMetadata.of( ValueType.YEAR_FRACTION, 1d, ValueType.STRIKE, 3d); coverImmutableBean(test); SimpleSurfaceParameterMetadata test2 = SimpleSurfaceParameterMetadata.of( ValueType.ZERO_RATE, 2d, ValueType.SIMPLE_MONEYNESS, 4d); coverBeanEquals(test, test2); }
/** * Gets the metadata of the parameter at the specified index. * <p> * If there is no specific parameter metadata, {@link SimpleSurfaceParameterMetadata} will be created. * * @param parameterIndex the zero-based index of the parameter to get * @return the metadata of the parameter * @throws IndexOutOfBoundsException if the index is invalid */ @Override public default ParameterMetadata getParameterMetadata(int parameterIndex) { return getMetadata().getParameterMetadata().map(pm -> pm.get(parameterIndex)) .orElse(SimpleSurfaceParameterMetadata.of( getMetadata().getXValueType(), getXValues().get(parameterIndex), getMetadata().getYValueType(), getYValues().get(parameterIndex))); }
/** * Obtains an instance specifying information about the x-value. * * @param xValueType the x-value type * @param xValue the x-value * @param yValueType the x-value type * @param yValue the x-value * @return the parameter metadata based on the date and label */ public static SimpleSurfaceParameterMetadata of( ValueType xValueType, double xValue, ValueType yValueType, double yValue) { return new SimpleSurfaceParameterMetadata(xValueType, xValue, yValueType, yValue); }