@Override public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) { try { return metaBean.metaProperty(propertyName); } catch (NoSuchElementException ex) { if (HOLIDAYS.name().equals(propertyName)) { return HOLIDAYS; } if (WEEKEND_DAYS.name().equals(propertyName)) { return WEEKEND_DAYS; } throw ex; } }
@Override public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) { try { return metaBean.metaProperty(propertyName); } catch (NoSuchElementException ex) { if (BASE_CURRENCY_AMOUNT.name().equals(propertyName)) { return BASE_CURRENCY_AMOUNT; } if (COUNTER_CURRENCY_AMOUNT.name().equals(propertyName)) { return COUNTER_CURRENCY_AMOUNT; } if (PAYMENT_DATE.name().equals(propertyName)) { return PAYMENT_DATE; } throw ex; } }
@Override public Object get(String propertyName) { if (propertyName.equals(ARRAY.name())) { return array.clone(); } else { throw new NoSuchElementException("Unknown property: " + propertyName); } }
@Override public Object get(String propertyName) { if (propertyName.equals(ARRAY.name())) { return array.clone(); } else { throw new NoSuchElementException("Unknown property: " + propertyName); } }
@Override public BeanBuilder<IntArray> set(String propertyName, Object value) { if (propertyName.equals(ARRAY.name())) { this.array = ((int[]) ArgChecker.notNull(value, "value")).clone(); } else { throw new NoSuchElementException("Unknown property: " + propertyName); } return this; }
@Override public BeanBuilder<DoubleArray> set(String propertyName, Object value) { if (propertyName.equals(ARRAY.name())) { this.array = ((double[]) ArgChecker.notNull(value, "value")).clone(); } else { throw new NoSuchElementException("Unknown property: " + propertyName); } return this; }
public void test_builder() { assertThrowsIllegalArg(() -> DiscountFxForwardRates.meta().builder() .set(DiscountFxForwardRates.meta().currencyPair(), CurrencyPair.parse("GBP/USD")).build()); assertThrowsIllegalArg(() -> DiscountFxForwardRates.meta().builder() .set(DiscountFxForwardRates.meta().currencyPair().name(), CurrencyPair.parse("GBP/USD")).build()); }