/** * Provide the Java Mail {@link Session} to use. * @param session the session. * @return the spec. * @see AbstractMailReceiver#setSession(Session) */ public S session(Session session) { assertReceiver(); this.receiver.setSession(session); this.sessionProvided = true; return _this(); }
/** * The Java Mail properties. * @param javaMailProperties the javaMailProperties. * @return the spec. * @see AbstractMailReceiver#setJavaMailProperties(Properties) */ public S javaMailProperties(Properties javaMailProperties) { assertReceiver(); assertSession(); this.receiver.setJavaMailProperties(javaMailProperties); return _this(); }
/** * Configure the {@code javaMailProperties} by invoking a {@link Consumer} callback which * is invoked with a {@link PropertiesBuilder}. * @param configurer the configurer. * @return the spec. * @see AbstractMailReceiver#setJavaMailProperties(Properties) */ public S javaMailProperties(Consumer<PropertiesBuilder> configurer) { PropertiesBuilder properties = new PropertiesBuilder(); configurer.accept(properties); return javaMailProperties(properties.get()); }
/** * Configure the {@code javaMailProperties} by invoking a {@link Consumer} callback which * is invoked with a {@link PropertiesBuilder}. * @param configurer the configurer. * @return the spec. * @see AbstractMailReceiver#setJavaMailProperties(Properties) */ public S javaMailProperties(Consumer<PropertiesBuilder> configurer) { PropertiesBuilder properties = new PropertiesBuilder(); configurer.accept(properties); return javaMailProperties(properties.get()); }
/** * The maximum for fetch size. * @param maxFetchSize the maxFetchSize. * @return the spec. * @see AbstractMailReceiver#setMaxFetchSize(int) */ public S maxFetchSize(int maxFetchSize) { assertReceiver(); this.receiver.setMaxFetchSize(maxFetchSize); return _this(); }
/** * The Java Mail {@link Authenticator}. * @param javaMailAuthenticator the javaMailAuthenticator. * @return the spec. * @see AbstractMailReceiver#setJavaMailAuthenticator(Authenticator) */ public S javaMailAuthenticator(Authenticator javaMailAuthenticator) { assertSession(); assertReceiver(); this.receiver.setJavaMailAuthenticator(javaMailAuthenticator); return _this(); }
/** * A flag to specify if messages should be deleted after receive. * @param shouldDeleteMessages the shouldDeleteMessages. * @return the spec. * @see AbstractMailReceiver#setShouldDeleteMessages(boolean) */ public S shouldDeleteMessages(boolean shouldDeleteMessages) { assertReceiver(); this.receiver.setShouldDeleteMessages(shouldDeleteMessages); return _this(); }
/** * The Java Mail {@link Authenticator}. * @param javaMailAuthenticator the javaMailAuthenticator. * @return the spec. * @see AbstractMailReceiver#setJavaMailAuthenticator(Authenticator) */ public S javaMailAuthenticator(Authenticator javaMailAuthenticator) { assertSession(); assertReceiver(); this.receiver.setJavaMailAuthenticator(javaMailAuthenticator); return _this(); }
/** * The maximum for fetch size. * @param maxFetchSize the maxFetchSize. * @return the spec. * @see AbstractMailReceiver#setMaxFetchSize(int) */ public S maxFetchSize(int maxFetchSize) { assertReceiver(); this.receiver.setMaxFetchSize(maxFetchSize); return _this(); }
/** * The Java Mail properties. * @param javaMailProperties the javaMailProperties. * @return the spec. * @see AbstractMailReceiver#setJavaMailProperties(Properties) */ public S javaMailProperties(Properties javaMailProperties) { assertReceiver(); assertSession(); this.receiver.setJavaMailProperties(javaMailProperties); return _this(); }
/** * Provide the Java Mail {@link Session} to use. * @param session the session. * @return the spec. * @see AbstractMailReceiver#setSession(Session) */ public S session(Session session) { assertReceiver(); this.receiver.setSession(session); this.sessionProvided = true; return _this(); }
/** * A flag to specify if messages should be deleted after receive. * @param shouldDeleteMessages the shouldDeleteMessages. * @return the spec. * @see AbstractMailReceiver#setShouldDeleteMessages(boolean) */ public S shouldDeleteMessages(boolean shouldDeleteMessages) { assertReceiver(); this.receiver.setShouldDeleteMessages(shouldDeleteMessages); return _this(); }
/** * Configure a SpEL expression to select messages. The root object for the expression * evaluation is a {@link javax.mail.internet.MimeMessage} which should return a boolean * result (true means select the message). * @param selectorExpression the selectorExpression. * @return the spec. * @since 1.2 */ public S selectorExpression(Expression selectorExpression) { assertReceiver(); this.receiver.setSelectorExpression(selectorExpression); return _this(); }
/** * Configure a SpEL expression to select messages. The root object for the expression * evaluation is a {@link javax.mail.internet.MimeMessage} which should return a boolean * result (true means select the message). * @param selectorExpression the selectorExpression. * @return the spec. * @since 1.2 */ public S selectorExpression(Expression selectorExpression) { assertReceiver(); this.receiver.setSelectorExpression(selectorExpression); return _this(); }
/** * Set the name of the flag to use to flag messages when the server does * not support \Recent but supports user flags; * default {@value AbstractMailReceiver#DEFAULT_SI_USER_FLAG}. * @param userFlag the flag. * @return the spec. * @since 1.2 * @see AbstractMailReceiver#setUserFlag(String) */ public S userFlag(String userFlag) { assertReceiver(); this.receiver.setUserFlag(userFlag); return _this(); }
/** * Set the name of the flag to use to flag messages when the server does * not support \Recent but supports user flags; * default {@value AbstractMailReceiver#DEFAULT_SI_USER_FLAG}. * @param userFlag the flag. * @return the spec. * @since 1.2 * @see AbstractMailReceiver#setUserFlag(String) */ public S userFlag(String userFlag) { assertReceiver(); this.receiver.setUserFlag(userFlag); return _this(); }
/** * Set the header mapper; if a header mapper is not provided, the message payload is * a {@link MimeMessage}, when provided, the headers are mapped and the payload is * the {@link MimeMessage} content. * @param headerMapper the header mapper. * @return the spec. * @since 1.2 * @see AbstractMailReceiver#setUserFlag(String) * @see #embeddedPartsAsBytes(boolean) */ public S headerMapper(HeaderMapper<MimeMessage> headerMapper) { assertReceiver(); this.receiver.setHeaderMapper(headerMapper); return _this(); }
/** * Set the header mapper; if a header mapper is not provided, the message payload is * a {@link MimeMessage}, when provided, the headers are mapped and the payload is * the {@link MimeMessage} content. * @param headerMapper the header mapper. * @return the spec. * @since 1.2 * @see AbstractMailReceiver#setUserFlag(String) * @see #embeddedPartsAsBytes(boolean) */ public S headerMapper(HeaderMapper<MimeMessage> headerMapper) { assertReceiver(); this.receiver.setHeaderMapper(headerMapper); return _this(); }
/** * When a header mapper is provided determine whether an embedded {@link Part} (e.g * {@link Message} or {@link javax.mail.Multipart} content is rendered as a byte[] in the * payload. Otherwise, leave as a {@link Part}. These objects are not suitable for * downstream serialization. Default: true. * <p>This has no effect if there is no header mapper, in that case the payload is the * {@link MimeMessage}. * @param embeddedPartsAsBytes the embeddedPartsAsBytes to set. * @return the spec. * @since 1.2 * @see #headerMapper(HeaderMapper) */ public S embeddedPartsAsBytes(boolean embeddedPartsAsBytes) { assertReceiver(); this.receiver.setEmbeddedPartsAsBytes(embeddedPartsAsBytes); return _this(); }
/** * When a header mapper is provided determine whether an embedded {@link Part} (e.g * {@link Message} or {@link javax.mail.Multipart} content is rendered as a byte[] in the * payload. Otherwise, leave as a {@link Part}. These objects are not suitable for * downstream serialization. Default: true. * <p>This has no effect if there is no header mapper, in that case the payload is the * {@link MimeMessage}. * @param embeddedPartsAsBytes the embeddedPartsAsBytes to set. * @return the spec. * @since 1.2 * @see #headerMapper(HeaderMapper) */ public S embeddedPartsAsBytes(boolean embeddedPartsAsBytes) { assertReceiver(); this.receiver.setEmbeddedPartsAsBytes(embeddedPartsAsBytes); return _this(); }