/** * Read a bare item of the collection from the reader. * * @param reader the source reader * @param context the unmarshalling context * @param current the target collection (if already available) * @return the read item * @since 1.4.11 */ protected Object readBareItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Object current) { Class type = HierarchicalStreams.readClassType(reader, mapper()); return context.convertAnother(current, type); }
protected Object createCollection(Class type) { return super.createCollection(this.type != null ? this.type : type); } }
/** * @deprecated As of 1.4.11 use {@link #readBareItem(HierarchicalStreamReader, UnmarshallingContext, Object)} or * {@link #readCompleteItem(HierarchicalStreamReader, UnmarshallingContext, Object)} instead. */ protected Object readItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Object current) { return readBareItem(reader, context, current); }
/** * @deprecated As of 1.4.11 use {@link #writeCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)} * instead. */ protected void writeItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) { // PUBLISHED API METHOD! If changing signature, ensure backwards compatibility. if (item == null) { // todo: this is duplicated in TreeMarshaller.start() writeNullItem(context, writer); } else { String name = mapper().serializedClass(item.getClass()); ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, item.getClass()); writeBareItem(item, context, writer); writer.endNode(); } }
/** * Write an item of the collection into the writer including surrounding tags. * * @param item the item to write * @param context the current marshalling context * @param writer the target writer * @since 1.4.11 */ protected void writeCompleteItem(final Object item, final MarshallingContext context, final HierarchicalStreamWriter writer) { writeItem(item, context, writer); }
/** * Read an item of the collection including the tags from the reader. * * @param reader the source reader * @param context the unmarshalling context * @param current the target collection (if already available) * @return the read item * @since 1.4.11 */ protected Object readCompleteItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Object current) { reader.moveDown(); final Object result = readItem(reader, context, current); reader.moveUp(); return result; }
/** * @deprecated As of 1.4.11 use {@link #writeCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)} * instead. */ protected void writeItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) { // PUBLISHED API METHOD! If changing signature, ensure backwards compatibility. if (item == null) { // todo: this is duplicated in TreeMarshaller.start() writeNullItem(context, writer); } else { String name = mapper().serializedClass(item.getClass()); ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, item.getClass()); writeBareItem(item, context, writer); writer.endNode(); } }
/** * Write an item of the collection into the writer including surrounding tags. * * @param item the item to write * @param context the current marshalling context * @param writer the target writer * @since 1.4.11 */ protected void writeCompleteItem(final Object item, final MarshallingContext context, final HierarchicalStreamWriter writer) { writeItem(item, context, writer); }
/** * Read an item of the collection including the tags from the reader. * * @param reader the source reader * @param context the unmarshalling context * @param current the target collection (if already available) * @return the read item * @since 1.4.11 */ protected Object readCompleteItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Object current) { reader.moveDown(); final Object result = readItem(reader, context, current); reader.moveUp(); return result; }
protected Object createCollection(Class type) { ErrorWritingException ex = null; Class defaultType = mapper().defaultImplementationOf(type); try { return defaultType.newInstance(); } catch (InstantiationException e) { ex = new ConversionException("Cannot instantiate default collection", e); } catch (IllegalAccessException e) { ex = new ObjectAccessException("Cannot instantiate default collection", e); } ex.add("collection-type", type.getName()); ex.add("default-type", defaultType.getName()); throw ex; } }
/** * @deprecated As of 1.4.11 use {@link #writeCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)} * instead. */ protected void writeItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) { // PUBLISHED API METHOD! If changing signature, ensure backwards compatibility. if (item == null) { // todo: this is duplicated in TreeMarshaller.start() writeNullItem(context, writer); } else { String name = mapper().serializedClass(item.getClass()); ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, item.getClass()); writeBareItem(item, context, writer); writer.endNode(); } }
protected Object createCollection(Class type) { return super.createCollection(this.type != null ? this.type : type); } }
/** * Write an item of the collection into the writer including surrounding tags. * * @param item the item to write * @param context the current marshalling context * @param writer the target writer * @since 1.4.11 */ protected void writeCompleteItem(final Object item, final MarshallingContext context, final HierarchicalStreamWriter writer) { writeItem(item, context, writer); }
/** * @deprecated As of 1.4.11 use {@link #readBareItem(HierarchicalStreamReader, UnmarshallingContext, Object)} or * {@link #readCompleteItem(HierarchicalStreamReader, UnmarshallingContext, Object)} instead. */ protected Object readItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Object current) { return readBareItem(reader, context, current); }
/** * Read an item of the collection including the tags from the reader. * * @param reader the source reader * @param context the unmarshalling context * @param current the target collection (if already available) * @return the read item * @since 1.4.11 */ protected Object readCompleteItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Object current) { reader.moveDown(); final Object result = readItem(reader, context, current); reader.moveUp(); return result; }
/** * Write a null item of the collection into the writer. The method readItem should be able to process the written * data i.e. it has to write the tags or may not write anything at all. * * @param context the current marshalling context * @param writer the target writer * @since 1.4.11 */ protected void writeNullItem(final MarshallingContext context, final HierarchicalStreamWriter writer) { final String name = mapper().serializedClass(null); ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, Mapper.Null.class); writer.endNode(); }
/** * @deprecated As of 1.4.11 use {@link #writeCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)} * instead. */ protected void writeItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) { // PUBLISHED API METHOD! If changing signature, ensure backwards compatibility. if (item == null) { // todo: this is duplicated in TreeMarshaller.start() writeNullItem(context, writer); } else { String name = mapper().serializedClass(item.getClass()); ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, item.getClass()); writeBareItem(item, context, writer); writer.endNode(); } }
protected Object createCollection(Class type) { return super.createCollection(this.type != null ? this.type : type); } }
/** * Write an item of the collection into the writer including surrounding tags. * * @param item the item to write * @param context the current marshalling context * @param writer the target writer * @since 1.4.11 */ protected void writeCompleteItem(final Object item, final MarshallingContext context, final HierarchicalStreamWriter writer) { writeItem(item, context, writer); }
/** * @deprecated As of 1.4.11 use {@link #readBareItem(HierarchicalStreamReader, UnmarshallingContext, Object)} or * {@link #readCompleteItem(HierarchicalStreamReader, UnmarshallingContext, Object)} instead. */ protected Object readItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Object current) { return readBareItem(reader, context, current); }