chibenwa commented on code in PR #1501: URL: https://github.com/apache/james-project/pull/1501#discussion_r1145842865
########## mailet/api/src/main/java/org/apache/mailet/FUTURERELEASEParameters.java: ########## @@ -0,0 +1,126 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.mailet; + +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Preconditions; + +public class FUTURERELEASEParameters { + public static final String HOLDFOR_PARAMETER = "HOLDFOR"; + public static final String HOLDUNITL_PARAMETER = "HOLDUNITL"; + + public static class Holdfor{ + public static Optional<Holdfor> fromSMTPArgLine(Map<String, Integer> mailFromArgLine) { + return Optional.ofNullable(mailFromArgLine.get(HOLDFOR_PARAMETER)) + .map(Holdfor::of); + } + + public static Holdfor fromAttributeValue(AttributeValue<Integer> attributeValue) { + return of(attributeValue.value()); + } + + private final Integer value; + + public static Holdfor of (Integer value) { + Preconditions.checkNotNull(value); +// Preconditions.checkArgument(XText.isValid(value), "According to RFC-4865 Holdfor should be a valid xtext" + +// ", thus composed of CHARs between \"!\" (33) and \"~\" (126) inclusive, except for \"+\" and \"=\" or follow the hexadecimal escape sequence."); Review Comment: XText is only for DSN -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
