in commons/src/main/java/com/epam/eco/kafkamanager/ConsumerGroupInfo.java [58:126]
public ConsumerGroupInfo(
@JsonProperty("name") String name,
@JsonProperty("coordinator") Integer coordinator,
@JsonProperty("state") ConsumerGroupState state,
@JsonProperty("protocolType") String protocolType,
@JsonProperty("partitionAssignor") String partitionAssignor,
@JsonProperty("members") Collection<ConsumerGroupMemberInfo> members,
@JsonProperty("offsetsAndMetadata") Map<TopicPartition, OffsetAndMetadataInfo> offsetsAndMetadata,
@JsonProperty("offsetTimeSeries") Map<TopicPartition, OffsetTimeSeries> offsetTimeSeries,
@JsonProperty("storageType") StorageType storageType,
@JsonProperty("metadata") Metadata metadata) {
Validate.notBlank(name, "Name is blank");
if (members != null) {
Validate.noNullElements(members, "Collection of members contains null elements");
}
if (offsetsAndMetadata != null) {
Validate.noNullElements(
offsetsAndMetadata.keySet(), "Map of offsets contains null keys");
Validate.noNullElements(
offsetsAndMetadata.values(), "Map of offsets contains null values");
}
if (offsetTimeSeries != null) {
Validate.noNullElements(
offsetTimeSeries.keySet(), "Map of offset timeseries contains null keys");
Validate.noNullElements(
offsetTimeSeries.values(), "Map of offset timeseries contains null values");
}
Validate.notNull(storageType, "Storage type is null");
this.name = name;
this.coordinator = coordinator;
this.state = state;
this.protocolType = protocolType;
this.partitionAssignor = partitionAssignor;
this.members =
!CollectionUtils.isEmpty(members) ?
members.stream().
sorted().
collect(
Collectors.collectingAndThen(
Collectors.toList(),
Collections::unmodifiableList)) :
Collections.emptyList();
this.offsetsAndMetadata =
!MapUtils.isEmpty(offsetsAndMetadata) ?
Collections.unmodifiableMap(
KafkaUtils.sortedByTopicPartitionKeyMap(offsetsAndMetadata)) :
Collections.emptyMap();
this.offsets =
!MapUtils.isEmpty(offsetsAndMetadata) ?
Collections.unmodifiableMap(
KafkaUtils.sortedByTopicPartitionKeyMap(
offsetsAndMetadata.entrySet().stream().
collect(
Collectors.toMap(
entry -> entry.getKey(),
entry -> entry.getValue().getOffset())))) :
Collections.emptyMap();
this.offsetTimeSeries =
!MapUtils.isEmpty(offsetTimeSeries) ?
Collections.unmodifiableMap(new HashMap<>(offsetTimeSeries)) :
Collections.emptyMap();
this.topicNames =
Collections.unmodifiableList(
KafkaUtils.extractTopicNamesAsSortedList(this.offsets.keySet()));
this.storageType = storageType;
this.metadata = metadata;
}