Class CompositeMailReaderHandler<T>
java.lang.Object
ch.tocco.nice2.messaging.mail.api.AbstractMailboxReaderHandler<T>
ch.tocco.nice2.messaging.mail.api.CompositeMailReaderHandler<T>
- All Implemented Interfaces:
MailboxReaderHandler<T>
,Iterable<MailboxReaderHandler<T>>
public class CompositeMailReaderHandler<T>
extends AbstractMailboxReaderHandler<T>
implements Iterable<MailboxReaderHandler<T>>
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionCompositeMailReaderHandler
(MailboxReaderHandler<T>... handlers) CompositeMailReaderHandler
(Iterable<MailboxReaderHandler<T>> handlers) CompositeMailReaderHandler
(Iterable<MailboxReaderHandler<T>> handlers, CompositeMailReaderHandler.Progress<?> progress) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHandler
(int index, MailboxReaderHandler<T> handler) void
addHandler
(MailboxReaderHandler<T> handler) void
addHandlers
(MailboxReaderHandler<T>... handlers) void
addHandlers
(Iterable<MailboxReaderHandler<T>> handlers) copy()
copyWithProgress
(CompositeMailReaderHandler.Progress<R> progress) void
finish
(MailboxReader.Context<T> context) Called once after iterating finished, regardless of error.getHandler
(int index) int
void
init
(MailboxReader.Context<T> context) Called once before the reading process starts.iterator()
void
onMessage
(jakarta.mail.Message message, MailboxReader.Context<T> context) Called for each message.void
removeHandler
(MailboxReaderHandler<T> handler) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CompositeMailReaderHandler
public CompositeMailReaderHandler(Iterable<MailboxReaderHandler<T>> handlers, CompositeMailReaderHandler.Progress<?> progress) -
CompositeMailReaderHandler
-
CompositeMailReaderHandler
-
-
Method Details
-
addHandler
-
addHandler
-
addHandlers
-
addHandlers
-
removeHandler
-
getHandler
-
getHandlerCount
public int getHandlerCount() -
init
Description copied from interface:MailboxReaderHandler
Called once before the reading process starts.- Specified by:
init
in interfaceMailboxReaderHandler<T>
- Overrides:
init
in classAbstractMailboxReaderHandler<T>
-
finish
Description copied from interface:MailboxReaderHandler
Called once after iterating finished, regardless of error.- Specified by:
finish
in interfaceMailboxReaderHandler<T>
- Overrides:
finish
in classAbstractMailboxReaderHandler<T>
-
onMessage
public void onMessage(jakarta.mail.Message message, MailboxReader.Context<T> context) throws jakarta.mail.MessagingException Description copied from interface:MailboxReaderHandler
Called for each message. TheMessagingException
is wrapped in aMailException
to comply to the api of this module. All other execptions are propagated (wrapped inRuntimeException
if necessary).- Specified by:
onMessage
in interfaceMailboxReaderHandler<T>
- Throws:
jakarta.mail.MessagingException
-
iterator
-
copy
-
copyWithProgress
public <R> CompositeMailReaderHandler<T> copyWithProgress(CompositeMailReaderHandler.Progress<R> progress)
-