/** * Creates a new instance for the given topic with the associated properties. * The properties provided can optionally be validated to see if it contains valid * values for all required properties. * * @throws IllegalArgumentException if {@code validate} is {@code true} and the provided properties is not valid. */ public TopicMetadata(TopicId topicId, Map<String, String> properties, boolean validate) { this.topicId = topicId; this.properties = ImmutableMap.copyOf(properties); if (validate) { validateProperties(); } this.validated = validate; }
/** * Creates a new instance for the given topic with the associated properties. * The properties provided can optionally be validated to see if it contains valid * values for all required properties. * * @throws IllegalArgumentException if {@code validate} is {@code true} and the provided properties is not valid. */ public TopicMetadata(TopicId topicId, Map<String, String> properties, boolean validate) { this.topicId = topicId; this.properties = ImmutableMap.copyOf(properties); if (validate) { validateProperties(); } this.validated = validate; }