@Override public MqttSource build() { if (delegate == null) { delegate = delegateBuilder.build(); } return new ImmutableMqttSource(delegate, qos); } }
/** * Create a copy of this object with error message set. * * @param enforcement the enforcement options * @return a copy of this object. */ public static Enforcement newEnforcement(final Enforcement enforcement) { return ImmutableEnforcement.of(enforcement.getInput(), enforcement.getFilters()); }
/** * Creates a new {@link Source}. * * @param authorizationContext the authorization context * @param address the source address where messages are consumed from * @return the created {@link Source} */ public static Source newSource(final AuthorizationContext authorizationContext, final String address) { return newSourceBuilder().address(address).authorizationContext(authorizationContext).build(); }
@Override public Connection build() { checkSourceAndTargetAreValid(); checkAuthorizationContextsAreValid(); return new ImmutableConnection(this); }
@Override public Target withAddress(final String newAddress) { return new ImmutableMqttTarget(delegate.withAddress(newAddress), qos); }
/** * Returns a mutable builder with a fluent API for an immutable {@link Connection}. The builder is initialised with * the values of the given Connection. * * @param connection the Connection which provides the initial values of the builder. * @return the new builder. * @throws NullPointerException if {@code connection} is {@code null}. */ public static ConnectionBuilder newConnectionBuilder(final Connection connection) { return ImmutableConnection.getBuilder(connection); }
/** * A mutable builder for a {@code MessageMapperConfigurationFailedException}. * * @param errorMessage the errorMessage describing why the mapper configuration failed. * @return the builder. */ public static Builder newBuilder(final String errorMessage) { return new Builder(errorMessage); }
/** * Returns a new {@code TargetMetrics}. * * @param addressMetrics the AddressMetrics of all addresses in the target * @param publishedMessages the amount of published messages * @return a new SourceMetrics which is initialised with the extracted data from {@code jsonObject}. * @throws NullPointerException if {@code connectionStatus} is {@code null}. */ public static TargetMetrics newTargetMetrics(final Map<String, AddressMetric> addressMetrics, final long publishedMessages) { return ImmutableTargetMetrics.of(addressMetrics, publishedMessages); }
/** * Creates a new {@code AddressMetric} object from the specified JSON object. * * @param jsonObject a JSON object which provides the data for the Connection to be created. * @return a new AddressMetric 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 AddressMetric addressMetricFromJson(final JsonObject jsonObject) { return ImmutableAddressMetric.fromJson(jsonObject); }
/** * Creates a new {@link TargetBuilder} for building {@link Target}s. * * @return new {@link Target} builder */ public static TargetBuilder newTargetBuilder() { return new ImmutableTarget.Builder(); }
/** * A mutable builder for a {@code MessageMapperConfigurationInvalidException}. * * @param missingConfigurationProperty the missingConfigurationProperty which was not present in the config. * @return the builder. */ public static Builder newBuilder(final String missingConfigurationProperty) { return new Builder(missingConfigurationProperty); }
/** * Creates a new {@code ImmutableSourceMetrics} instance. * * @param addressMetrics the AddressMetrics for each source * @param consumedMessages the total count of consumed messages on this source * @return a new instance of ImmutableSourceMetrics */ public static ImmutableSourceMetrics of(final Map<String, AddressMetric> addressMetrics, final long consumedMessages) { return new ImmutableSourceMetrics(addressMetrics, consumedMessages); }
@Override public MqttSourceBuilder index(final int index) { delegateBuilder.index(index); return this; }
/** * Creates a new {@link Source}. * * @param authorizationContext the authorization context * @param address the source address where messages are consumed from * @param index the index inside the connection * @return the created {@link Source} */ public static Source newSource(final AuthorizationContext authorizationContext, final String address, final int index) { return newSourceBuilder().address(address).authorizationContext(authorizationContext).index(index).build(); }
/** * Create a copy of this object with error message set. * * @param enforcement the enforcement options * @return a copy of this object. */ public static Enforcement newEnforcement(final Enforcement enforcement) { return ImmutableEnforcement.of(enforcement.getInput(), enforcement.getFilters()); }
@Override public Connection build() { checkSourceAndTargetAreValid(); checkAuthorizationContextsAreValid(); return new ImmutableConnection(this); }
@Override public Target withAddress(final String newAddress) { return new ImmutableMqttTarget(delegate.withAddress(newAddress), qos); }
@Override public MqttSource build() { if (delegate == null) { delegate = delegateBuilder.build(); } return new ImmutableMqttSource(delegate, qos); } }
/** * Creates a new {@link Source}. * * @param authorizationContext the authorization context * @param address the source address where messages are consumed from * @param index the index inside the connection * @return the created {@link Source} */ public static Source newSource(final AuthorizationContext authorizationContext, final String address, final int index) { return newSourceBuilder().address(address).authorizationContext(authorizationContext).index(index).build(); }
/** * Creates a new {@link Source}. * * @param authorizationContext the authorization context * @param address the source address where messages are consumed from * @return the created {@link Source} */ public static Source newSource(final AuthorizationContext authorizationContext, final String address) { return newSourceBuilder().address(address).authorizationContext(authorizationContext).build(); }