Esempio n. 1
0
 @Override
 public <V> V get(ChronoElement<V> element) {
   Object ret;
   if (element == PlainTime.DIGITAL_HOUR_OF_DAY) {
     ret = Integer.valueOf(10);
   } else if (element == PlainTime.DECIMAL_MINUTE) {
     ret = new BigDecimal("2.75");
   } else {
     throw new ChronoException("Not registered: " + element.name());
   }
   return element.getType().cast(ret);
 }
Esempio n. 2
0
  @Override
  public FormatProcessor<V> withElement(ChronoElement<V> element) {

    if (this.element == element) {
      return this;
    } else if (element instanceof TextElement) {
      return TextProcessor.create((TextElement<V>) element);
    } else {
      throw new IllegalArgumentException("Text element required: " + element.getClass().getName());
    }
  }