Пример #1
0
 @Override
 public String toString() {
   return String.format(
       "OtherText [%s/%s]: %s",
       (textType == null) ? null : textType.name(),
       (textFormat == null) ? null : textFormat.name(),
       text);
 }
Пример #2
0
  @Override
  public JonixConsumer consume(
      Object o, Object parent, Object grandParent, JonixResolver resolver) {
    if (resolver.onixTypeOf(o) == ONIX.OtherText) {
      String textTypeCode =
          (String) JonixUtils.getProperty(o, resolver.onixPropOf(ONIX.TextTypeCode), "value");
      String textFormatCode =
          (String) JonixUtils.getProperty(o, resolver.onixPropOf(ONIX.TextFormat), "value");

      String text = null;
      Object textObj = JonixUtils.getProperty(o, resolver.onixPropOf(ONIX.Text));
      if (textObj != null) {
        text = JonixUtils.getContentAsStr(textObj);
        if (textFormatCode == null)
          textFormatCode = (String) JonixUtils.getProperty(textObj, "textformat");
      }
      add(
          new OtherText(
              TextTypes.fromCode(textTypeCode), TextFormats.fromCode(textFormatCode), text));
      return this;
    }

    return null;
  }