If not already created, a new <code>writer</code> element with the given value will be created.
Otherwise, the existing <code>writer</code> element will be returned.
@return  a new or existing instance of <code>ItemWriter<Chunk<T>></code>
358381
public ItemWriter<Chunk<T>> getOrCreateWriter()
   {
      Node node = childNode.getOrCreate("writer");
      ItemWriter<Chunk<T>> writer = new ItemWriterImpl<Chunk<T>>(this, "writer", childNode, node);
      return writer;
   }
32890
public TableWriteItems withItemsToPut(Item ... itemsToPut) {
        if (itemsToPut == null)
            this.itemsToPut = null;
        else
            this.itemsToPut = new ArrayList<Item>(Arrays.asList(itemsToPut));
        return this;
    }
294690
public Writer appendTo(Writer writer) throws IOException {
    writer.write("<table class=\"wiki-table\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");
    List[] outputRows = (List[]) rows.toArray(new List[0]);
    int rowSize = outputRows.length;
    boolean odd = true;
    for (int i = 0; i < rowSize; i++) {
      writer.write("<tr");
      if (i == 0) {
        writer.write(">");
      } else if (odd) {
        writer.write(" class=\"table-odd\">");
        odd = false;
      } else {
        writer.write(" class=\"table-even\">");
        odd = true;
      }
      String[] outputCols = (String[]) outputRows[i].toArray(new String[0]);
      int colSize = outputCols.length;
      for (int j = 0; j < colSize; j++) {
        writer.write(i == 0 ? "<th>" : "<td>");
        if (outputCols[j] == null || outputCols[j].trim().length() == 0) {
          writer.write("&#160;");
        } else {
          writer.write(outputCols[j]);
        }
        writer.write(i == 0 ? "</th>" : "</td>");
      }
      writer.write("</tr>");
    }
    writer.write("</table>");
    return writer;
  }
1216243
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ XMLStreamReader.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return XMLStreamReader.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new XMLStreamReaderHandle() : null;
        return handle;
      }
    };
  }
324192
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ Document.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return Document.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
          (ContentHandle<C>) new DOM4JHandle() : null;
        return handle;
      }
    };
  }
298857
public static XdmValue newValue(ValueType valueType, Object value) {
        if (value instanceof Text) {
            return ValueFactory.newValue(valueType, ((Text)value).toString());
        } else if (value instanceof BytesWritable) {
            return ValueFactory.newValue(valueType, ((BytesWritable)value).getBytes());
        } else if (value instanceof IntWritable) {
            return ValueFactory.newValue(valueType, ((IntWritable)value).get());
        } else if (value instanceof LongWritable) {
            return ValueFactory.newValue(valueType, ((LongWritable)value).get());
        } else if (value instanceof VIntWritable) {
            return ValueFactory.newValue(valueType, ((VIntWritable)value).get());
        } else if (value instanceof VLongWritable) {
            return ValueFactory.newValue(valueType, ((VLongWritable)value).get());
        } else if (value instanceof BooleanWritable) {
            return ValueFactory.newValue(valueType, ((BooleanWritable)value).get());
        } else if (value instanceof FloatWritable) {
            return ValueFactory.newValue(valueType, ((FloatWritable)value).get());
        } else if (value instanceof DoubleWritable) {
            return ValueFactory.newValue(valueType, ((DoubleWritable)value).get());
        } else if (value instanceof MarkLogicNode) {
            return ValueFactory.newValue(valueType, ((MarkLogicNode)value).get());
        } else {
            throw new UnsupportedOperationException("Value " +  
                    value.getClass().getName() + " is unsupported.");
        }
    }
1133320
public void xmlWriteOn(FormattedWriter writer) throws IOException {
        writer.newLine();
        writer.startTag(XML_ITEM_MAP);
        writer.indent();
        for (int i = 0; i < _entry.length; i++) {
            Entry entry =  _entry[i];
            while (null != entry) {
                AbstractItemLink ail = entry.link;
                writer.newLine();
                ail.xmlShortWriteOn(writer);
                entry = entry.next;
            }
        }
        writer.outdent();
        writer.newLine();
        writer.endTag(XML_ITEM_MAP);
    }
818976
@Override
    public java.util.concurrent.Future<BatchWriteItemResult> batchWriteItemAsync(java.util.Map<String, java.util.List<WriteRequest>> requestItems) {

        return batchWriteItemAsync(new BatchWriteItemRequest().withRequestItems(requestItems));
    }
611934
protected ItemHolder create(final SelectableChannel channel, final EventsHandler handler, final int events)
    {
        Objects.requireNonNull(channel, "Channel has to be non-null");
        return creator.create(channel, handler, events);
    }
963266
public DocumentReaderAndWriter<IN> makeReaderAndWriter() {
    DocumentReaderAndWriter<IN> readerAndWriter;
    try {
      readerAndWriter = ((DocumentReaderAndWriter<IN>)
                         Class.forName(flags.readerAndWriter).newInstance());
    } catch (Exception e) {
      throw new RuntimeException(String.format("Error loading flags.readerAndWriter: '%s'", flags.readerAndWriter), e);
    }
    readerAndWriter.init(flags);
    return readerAndWriter;
  }
845925
public static <T> Iterable<PSArray<T>> create(Iterable<T> items, final Comparator<T> comparator) {
        MutableArray<T> initial = MutableArrayFromIterable.create(items);
        GoodSortingAlgorithm.getInstance().sort(initial, comparator);
        return IterableUsingStatusUpdater.create(initial, new Updater<PSArray<T>>() {
            @Override
            public PSArray<T> getUpdatedOrNull(PSArray<T> current) {
                MutableArray<T> next = MutableArrayFromIterable.create(current);
                boolean success = NextPermutation.step(next, comparator);
                return success ? next : null;
            }
        });
    }
498576
@Override
	public CommerceWishListItem create(long commerceWishListItemId) {
		CommerceWishListItem commerceWishListItem = new CommerceWishListItemImpl();

		commerceWishListItem.setNew(true);
		commerceWishListItem.setPrimaryKey(commerceWishListItemId);

		commerceWishListItem.setCompanyId(companyProvider.getCompanyId());

		return commerceWishListItem;
	}
1218659
public static <T> Writer<Params<T>> writer(final Writer<? super T> writer) {
		return elem(
			"params",
			attr("name").map(Params::getName),
			elems("param", writer)
		);
	}
1338430
public JsonWriter object() {
        startValue();

        stack.push(context);
        context = new JsonContext(JsonContext.Mode.MAP);
        writer.write('{');

        return this;
    }
1288947
public WritableByteChannel asWritableByteChannel() {

		// Bufferless/direct output
		if (packetSize < 2) {
			return new WritableByteChannel() {

				@Override
				public final boolean isOpen() {
					return !closed.get();
				}

				@Override
				public final void close() {
					sendClose();
				}

				@Override
				public final int write(ByteBuffer src) {
					try {
						int len = src.remaining();
						if (len > 0) {
							byte[] packet = new byte[len];
							src.get(packet);
							sendData(packet);
						}
						return len;
					} catch (Throwable cause) {
						try {
							sendError(cause);
						} catch (Throwable ignored) {
						}
						throw cause;
					}
				}

				@Override
				protected final void finalize() throws Throwable {
					close();
				}

			};
		}

		// Buffered output
		final OutputStream out = asOutputStream();
		return new WritableByteChannel() {

			@Override
			public final boolean isOpen() {
				return !closed.get();
			}

			@Override
			public final void close() throws IOException {
				out.flush();
				out.close();
			}

			@Override
			public final int write(ByteBuffer src) throws IOException {
				try {
					int len = src.remaining();
					if (len > 0) {
						byte[] packet = new byte[len];
						src.get(packet);
						out.write(packet);
					}
					return len;
				} catch (Throwable cause) {
					try {
						sendError(cause);
					} catch (Throwable ignored) {
					}
					throw cause;
				}
			}

		};
	}
189969
private Object writeCounted(final SerIterator itemIterator) {
        List<Object> result = new ArrayList<>();
        while (itemIterator.hasNext()) {
            itemIterator.next();
            Object outputValue = writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);
            int outputCount = itemIterator.count();
            result.add(Arrays.asList(outputValue, outputCount));
        }
        return result;
    }
468249
@Override
    public Iterator<T> iterator()
    {
        writeLock.lock();
        if (iterator == null)
        {
            iterator = new Iter();
        }
        else
        {
            iterator.reset();
        }
        return iterator;
    }