Record Class MqttTopic
java.lang.Object
java.lang.Record
energy.eddie.regionconnector.aiida.mqtt.MqttTopic
-
Constructor Summary
ConstructorsConstructorDescriptionMqttTopic(String prefix, String permissionId, MqttTopicType topicType) Creates an instance of aMqttTopicrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static StringextractPermissionIdFromTopic(String topicStr, MqttTopicType topicType, AiidaSchema schema) Extracts thepermissionIdfrom an MQTT topic.final inthashCode()Returns a hash code value for this object.static MqttTopicof(String permissionId, MqttTopicType topicType) Returns the value of thepermissionIdrecord component.prefix()Returns the value of theprefixrecord component.Returns the value of thetopicTyperecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MqttTopic
Creates an instance of aMqttTopicrecord class.- Parameters:
prefix- the value for theprefixrecord componentpermissionId- the value for thepermissionIdrecord componenttopicType- the value for thetopicTyperecord component
-
-
Method Details
-
of
-
extractPermissionIdFromTopic
public static String extractPermissionIdFromTopic(String topicStr, MqttTopicType topicType, @Nullable AiidaSchema schema) throws MqttTopicException Extracts thepermissionIdfrom an MQTT topic.The expected topic format depends on whether a schema is provided:
- Without schema:
aiida/v1/{permissionId}/{baseTopicName} - With schema:
aiida/v1/{permissionId}/{baseTopicName}/{schemaTopic}
The
baseTopicNameis derived from the givenMqttTopicType, and the optional schema suffix is taken fromAiidaSchema.topicName().- Parameters:
topicStr- the MQTT topic string to parsetopicType- the expected topic type (defines the base topic segment)schema- the schema used for this topic, ornullif no schema suffix is expected- Returns:
- the extracted permissionId
- Throws:
MqttTopicException- if the topic does not conform to the expected pattern
- Without schema:
-
eddieTopic
-
aiidaTopic
-
baseTopic
-
aiidaAcl
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
prefix
Returns the value of theprefixrecord component.- Returns:
- the value of the
prefixrecord component
-
permissionId
Returns the value of thepermissionIdrecord component.- Returns:
- the value of the
permissionIdrecord component
-
topicType
Returns the value of thetopicTyperecord component.- Returns:
- the value of the
topicTyperecord component
-