AndrewJSchofield commented on code in PR #16827: URL: https://github.com/apache/kafka/pull/16827#discussion_r1716692974
########## clients/src/main/java/org/apache/kafka/clients/admin/ShareGroupListing.java: ########## @@ -0,0 +1,97 @@ +/* + * 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.kafka.clients.admin; + +import org.apache.kafka.common.ShareGroupState; +import org.apache.kafka.common.annotation.InterfaceStability; + +import java.util.Objects; +import java.util.Optional; + +/** + * A listing of a share group in the cluster. + * <p> + * The API of this class is evolving, see {@link Admin} for details. + */ [email protected] +public class ShareGroupListing { + private final String groupId; + private final Optional<ShareGroupState> state; + + /** + * Create an instance with the specified parameters. + * + * @param groupId Group Id + */ + public ShareGroupListing(String groupId) { + this(groupId, Optional.empty()); + } + + /** + * Create an instance with the specified parameters. + * + * @param groupId Group Id + * @param state The state of the share group + */ + public ShareGroupListing(String groupId, Optional<ShareGroupState> state) { + this.groupId = groupId; + this.state = Objects.requireNonNull(state); + } + + /** + * The id of the share group. + */ + public String groupId() { + return groupId; + } + + /** + * The share group state. + */ + public Optional<ShareGroupState> state() { + return state; + } + + @Override + public String toString() { + return "(" + + "groupId='" + groupId + '\'' + + ", state=" + state + + ')'; + } + + @Override + public int hashCode() { + return Objects.hash(groupId, state); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + if (!(o instanceof ShareGroupListing)) Review Comment: Yes, you're correct. I'll take this in a follow-on PR. -- 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]
