Class ListBeanChannel<T>
- Type Parameters:
T- The type of bean stored in this channel.
- All Implemented Interfaces:
Iterable<T>,Consumer<T>,BeanChannel<T>,BeanConsumer<T>,BeanSupplier<T>,ThrowingConsumer<T>
BeanChannel implementation backed by an ArrayList.
Collects parsed elements into an in-memory list on the parser side, and iterates over the list on the serializer side. No factory or DI framework required — instantiated directly via no-arg constructor.
This is the default built-in implementation suitable for use cases where holding all elements
in memory is acceptable. For large datasets or database-backed scenarios, implement
BeanChannel (or BeanConsumer / BeanSupplier) directly.
Example (getter-only round-trip property):
See Also:
BeanChannel- Round-trip lifecycle interfaceBeanConsumer- Parse-only lifecycle interfaceBeanSupplier- Serialize-only lifecycle interface- Marshalling
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.juneau.commons.function.BeanChannel
begin, complete, onErrorMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.juneau.commons.function.ThrowingConsumer
accept
-
Constructor Details
-
ListBeanChannel
public ListBeanChannel()Constructor.
-
-
Method Details
-
acceptThrows
Description copied from interface:ThrowingConsumerPerforms this operation on the given argument, potentially throwing a checked exception.This is the functional method that implementations must provide. It allows checked exceptions to be thrown directly, unlike the standard
Consumer.accept(Object)method.Example:
ThrowingConsumer<String>
validator = (value ) -> {if (value ==null ||value .isEmpty()) {throw new ValidationException("Value cannot be empty" ); } };try {validator .acceptThrows("" ); }catch (ValidationExceptione ) {// Handle checked exception }- Specified by:
acceptThrowsin interfaceThrowingConsumer<T>- Parameters:
item- The input argument.
-
iterator
-
getList
Returns the underlying list of elements.- Returns:
- The list of elements collected during parsing, or to be serialized.
-