Пример #1
0
  @Override
  public JonixConsumer consume(
      Object o, Object parent, Object grandParent, JonixResolver resolver) {
    if (resolver.onixTypeOf(o) == ONIX.Language) {
      String languageRoleCode =
          (String) JonixUtils.getProperty(o, resolver.onixPropOf(ONIX.LanguageRole), "value");
      String languageCode =
          (String)
              JonixUtils.getProperty(
                  o, resolver.onixPropOf(ONIX.LanguageCode), "value", "value"); // List74
      add(new Language(LanguageRoles.fromCode(languageRoleCode), languageCode));
      return this;
    }

    return null;
  }
Пример #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;
  }