/** * Creates a new {@link MqttTarget} with MQTT specific configuration. * * @param target the delegate target * @param qos the target qos value * @return the created {@link Target} */ public static MqttTarget newMqttTarget(final Target target, final int qos) { return new ImmutableMqttTarget(target, qos); }
/** * Creates a new {@link MqttTarget} with MQTT specific configuration. * * @param target the delegate target * @param qos the target qos value * @return the created {@link Target} */ public static MqttTarget newMqttTarget(final Target target, final int qos) { return new ImmutableMqttTarget(target, qos); }
@Override public Target withAddress(final String newAddress) { return new ImmutableMqttTarget(delegate.withAddress(newAddress), qos); }
@Override public Target withAddress(final String newAddress) { return new ImmutableMqttTarget(delegate.withAddress(newAddress), qos); }
/** * Creates a new {@code Source} object from the specified JSON object. * * @param jsonObject a JSON object which provides the data for the Source to be created. * @return a new Source which is initialised with the extracted data from {@code jsonObject}. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonObject} is not an appropriate JSON object. */ public static Target fromJson(final JsonObject jsonObject) { final Target target = ImmutableTarget.fromJson(jsonObject); final int readQos = jsonObject.getValue(MqttTarget.JsonFields.QOS).orElse(DEFAULT_QOS); return new ImmutableMqttTarget(target, readQos); }
/** * Creates a new {@link MqttTarget} with MQTT specific configuration. * * @param address the address where the signals will be published * @param authorizationContext the authorization context of the new {@link Target} * @param qos the target qos value * @param requiredTopic the required topic that should be published via this target * @param additionalTopics additional set of topics that should be published via this target * @return the created {@link Target} */ public static MqttTarget newMqttTarget(final String address, final AuthorizationContext authorizationContext, final int qos, final Topic requiredTopic, final Topic... additionalTopics) { final HashSet<Topic> topics = new HashSet<>(Collections.singletonList(requiredTopic)); topics.addAll(Arrays.asList(additionalTopics)); final Target target = newTarget(address, authorizationContext, null, topics.stream() .map(ConnectivityModelFactory::newFilteredTopic) .collect(Collectors.toSet())); return new ImmutableMqttTarget(target, qos); }
/** * Creates a new {@link MqttTarget} with MQTT specific configuration. * * @param address the address where the signals will be published * @param authorizationContext the authorization context of the new {@link Target} * @param qos the target qos value * @param requiredTopic the required topic that should be published via this target * @param additionalTopics additional set of topics that should be published via this target * @return the created {@link Target} */ public static MqttTarget newMqttTarget(final String address, final AuthorizationContext authorizationContext, final int qos, final Topic requiredTopic, final Topic... additionalTopics) { final HashSet<Topic> topics = new HashSet<>(Collections.singletonList(requiredTopic)); topics.addAll(Arrays.asList(additionalTopics)); final Target target = newTarget(address, authorizationContext, null, topics.stream() .map(ConnectivityModelFactory::newFilteredTopic) .collect(Collectors.toSet())); return new ImmutableMqttTarget(target, qos); }
/** * Creates a new {@code Source} object from the specified JSON object. * * @param jsonObject a JSON object which provides the data for the Source to be created. * @return a new Source which is initialised with the extracted data from {@code jsonObject}. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonObject} is not an appropriate JSON object. */ public static Target fromJson(final JsonObject jsonObject) { final Target target = ImmutableTarget.fromJson(jsonObject); final int readQos = jsonObject.getValue(MqttTarget.JsonFields.QOS).orElse(DEFAULT_QOS); return new ImmutableMqttTarget(target, readQos); }