Exemplo n.º 1
0
  @Override
  public boolean read(ReadingContext aContext) {
    if (mappers == null) {
      withPCDataMappedTo(tagName);
    }

    if (aContext.isStartTagNamed(namespace, tagName)) {
      maybePushNewContextObject(aContext);

      try {
        if (attributes != null) attributes.read(aContext);

        while (aContext.isNotEndTag(namespace, tagName)) {
          for (XmlReader _m : mappers) {
            if (_m.read(aContext)) {
              break;
            }
          }
          aContext.next();
        }
        return true;
      } catch (XmlReadingException anExc) {
        throw anExc;
      } catch (Exception anExc) {
        throw new XmlReadingException(anExc);
      } finally {
        maybePopContext(aContext);
      }
    } else {
      return false;
    }
  }
Exemplo n.º 2
0
  private void maybePushNewContextObject(ReadingContext aContext) {
    if (type != null) {
      Object _ctx = aContext.peek();
      T _nestedCtx = newContextObject();

      getMutator(_ctx.getClass(), type, tagName).apply(_ctx, _nestedCtx);

      aContext.push(_nestedCtx);
    }
  }
Exemplo n.º 3
0
 private void maybePopContext(ReadingContext aContext) {
   if (type != null) {
     aContext.pop();
   }
 }