Arsnael commented on code in PR #1670: URL: https://github.com/apache/james-project/pull/1670#discussion_r1288016249
########## core/src/main/java/org/apache/james/core/StringWrapper.java: ########## @@ -0,0 +1,57 @@ +/**************************************************************** + * 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.james.core; + +import java.util.Objects; + +import com.google.common.base.MoreObjects; + +public class StringWrapper { Review Comment: Not sure this was necessary. Allows to reduce boiler plate, reduces readability though a bit IMO. But I'm not against it. ########## core/src/main/java/org/apache/james/core/quota/QuotaLimit.java: ########## @@ -0,0 +1,81 @@ +/**************************************************************** + * 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.james.core.quota; + +import java.util.Objects; + +public class QuotaLimit { + + public static QuotaLimit of(QuotaComponent component, QuotaScope scope, String identifier, QuotaType quotaType, long limit) { + return new QuotaLimit(component, scope, identifier, quotaType, limit); + } + + private final QuotaComponent quotaComponent; + private final QuotaScope quotaScope; + private final String identifier; Review Comment: Thinking what we could do here... Should be at least an Optional (global quota limit will not have an identifier for example) After the identifier will be either a Username (account limit) or a Domain (domain limit) But I guess if we want to be flexible to extensions even on the scope, String is likely fine I guess. But I would still make it Optional, for the global case ########## core/src/main/java/org/apache/james/core/quota/QuotaCurrentValue.java: ########## @@ -0,0 +1,74 @@ +/**************************************************************** + * 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.james.core.quota; + +import java.util.Objects; + +public class QuotaCurrentValue { + + public static QuotaCurrentValue of(QuotaComponent quotaComponent, String identifier, QuotaType quotaType, long currentValue) { + return new QuotaCurrentValue(quotaComponent, identifier, quotaType, currentValue); + } + + private final QuotaComponent quotaComponent; + private final String identifier; Review Comment: A quota current value would be logically the value of a user's usage... I would expect here Username instead of String ########## core/src/main/java/org/apache/james/core/quota/QuotaCurrentValue.java: ########## @@ -0,0 +1,74 @@ +/**************************************************************** + * 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.james.core.quota; + +import java.util.Objects; + +public class QuotaCurrentValue { + + public static QuotaCurrentValue of(QuotaComponent quotaComponent, String identifier, QuotaType quotaType, long currentValue) { + return new QuotaCurrentValue(quotaComponent, identifier, quotaType, currentValue); + } + + private final QuotaComponent quotaComponent; + private final String identifier; + private final QuotaType quotaType; + private final long currentValue; Review Comment: Optional<Long> ? Maybe there is no quota yet for a user that just got created and didnt receive any message yet for example? ########## core/src/main/java/org/apache/james/core/quota/QuotaLimit.java: ########## @@ -0,0 +1,81 @@ +/**************************************************************** + * 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.james.core.quota; + +import java.util.Objects; + +public class QuotaLimit { + + public static QuotaLimit of(QuotaComponent component, QuotaScope scope, String identifier, QuotaType quotaType, long limit) { + return new QuotaLimit(component, scope, identifier, quotaType, limit); + } + + private final QuotaComponent quotaComponent; + private final QuotaScope quotaScope; + private final String identifier; + private final QuotaType quotaType; + private final long limit; Review Comment: Optional<Long>? We can have undefined limits -- 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]
