@Override public RetrieveFeaturePropertyResponse setDittoHeaders(final DittoHeaders dittoHeaders) { return of(thingId, featureId, propertyPointer, propertyValue, dittoHeaders); }
/** * Creates a response to a {@link RetrieveFeatureProperty} command. * * @param thingId the Thing ID of the retrieved feature property. * @param featureId the identifier of the Feature whose Property was retrieved. * @param featurePropertyPointer the retrieved FeatureProperty JSON pointer. * @param featurePropertyValue the retrieved FeatureProperty value. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ public static RetrieveFeaturePropertyResponse of(final String thingId, final String featureId, final JsonPointer featurePropertyPointer, final JsonValue featurePropertyValue, final DittoHeaders dittoHeaders) { return new RetrieveFeaturePropertyResponse(thingId, featureId, featurePropertyPointer, featurePropertyValue, HttpStatusCode.OK, dittoHeaders); }
@Override public boolean equals(@Nullable final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final RetrieveFeaturePropertyResponse that = (RetrieveFeaturePropertyResponse) o; return that.canEqual(this) && Objects.equals(thingId, that.thingId) && Objects.equals(featureId, that.featureId) && Objects.equals(propertyPointer, that.propertyPointer) && Objects.equals(propertyValue, that.propertyValue) && super.equals(o); }
@Override public RetrieveFeaturePropertyResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, featureId, propertyPointer, entity, getDittoHeaders()); }
/** * Creates a response to a {@link RetrieveFeatureProperty} command from a JSON string. * * @param jsonString the JSON string of which the response is to be created. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws IllegalArgumentException if {@code jsonString} is empty. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected * format. */ public static RetrieveFeaturePropertyResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders) { return fromJson(JsonFactory.newObject(jsonString), dittoHeaders); }
@Override public RetrieveFeaturePropertyResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, featureId, propertyPointer, entity, getDittoHeaders()); }
/** * Creates a response to a {@link RetrieveFeatureProperty} command from a JSON string. * * @param jsonString the JSON string of which the response is to be created. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws IllegalArgumentException if {@code jsonString} is empty. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected * format. */ public static RetrieveFeaturePropertyResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders) { return fromJson(JsonFactory.newObject(jsonString), dittoHeaders); }
@Override public RetrieveFeaturePropertyResponse setDittoHeaders(final DittoHeaders dittoHeaders) { return of(thingId, featureId, propertyPointer, propertyValue, dittoHeaders); }
@Override public boolean equals(@Nullable final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final RetrieveFeaturePropertyResponse that = (RetrieveFeaturePropertyResponse) o; return that.canEqual(this) && Objects.equals(thingId, that.thingId) && Objects.equals(featureId, that.featureId) && Objects.equals(propertyPointer, that.propertyPointer) && Objects.equals(propertyValue, that.propertyValue) && super.equals(o); }
/** * Creates a response to a {@link RetrieveFeatureProperty} command. * * @param thingId the Thing ID of the retrieved feature property. * @param featureId the identifier of the Feature whose Property was retrieved. * @param featurePropertyPointer the retrieved FeatureProperty JSON pointer. * @param featurePropertyValue the retrieved FeatureProperty value. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ public static RetrieveFeaturePropertyResponse of(final String thingId, final String featureId, final JsonPointer featurePropertyPointer, final JsonValue featurePropertyValue, final DittoHeaders dittoHeaders) { return new RetrieveFeaturePropertyResponse(thingId, featureId, featurePropertyPointer, featurePropertyValue, HttpStatusCode.OK, dittoHeaders); }
@Nonnull @Override public RetrieveFeaturePropertyResponse retrieved(final JsonValue propertyValue) { return RetrieveFeaturePropertyResponse.of(command.getThingId(), command.getFeatureId(), command.getPropertyPointer(), propertyValue, command.getDittoHeaders()); }
@Nonnull @Override public RetrieveFeaturePropertyResponse retrieved(final JsonValue propertyValue) { return RetrieveFeaturePropertyResponse.of(command.getThingId(), command.getFeatureId(), command.getPropertyPointer(), propertyValue, command.getDittoHeaders()); }
private Result getRetrieveFeaturePropertyResult(final JsonObject featureProperties, final Context context, final RetrieveFeatureProperty command, @Nullable final Thing thing) { final String featureId = command.getFeatureId(); final JsonPointer propertyPointer = command.getPropertyPointer(); final DittoHeaders dittoHeaders = command.getDittoHeaders(); return featureProperties.getValue(propertyPointer) .map(featureProperty -> RetrieveFeaturePropertyResponse.of(context.getThingId(), featureId, propertyPointer, featureProperty, dittoHeaders)) .map(response -> ResultFactory.newQueryResult(command, thing, response, this)) .orElseGet(() -> ResultFactory.newErrorResult( ExceptionFactory.featurePropertyNotFound(context.getThingId(), featureId, propertyPointer, dittoHeaders))); }
private Result getRetrieveFeaturePropertyResult(final JsonObject featureProperties, final Context context, final RetrieveFeatureProperty command, @Nullable final Thing thing) { final String featureId = command.getFeatureId(); final JsonPointer propertyPointer = command.getPropertyPointer(); final DittoHeaders dittoHeaders = command.getDittoHeaders(); return featureProperties.getValue(propertyPointer) .map(featureProperty -> RetrieveFeaturePropertyResponse.of(context.getThingId(), featureId, propertyPointer, featureProperty, dittoHeaders)) .map(response -> ResultFactory.newQueryResult(command, thing, response, this)) .orElseGet(() -> ResultFactory.newErrorResult( ExceptionFactory.featurePropertyNotFound(context.getThingId(), featureId, propertyPointer, dittoHeaders))); }
/** * Creates a response to a {@link RetrieveFeatureProperty} command from a JSON object. * * @param jsonObject the JSON object of which the response is to be created. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static RetrieveFeaturePropertyResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandResponseJsonDeserializer<RetrieveFeaturePropertyResponse>(TYPE, jsonObject) .deserialize((statusCode) -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommandResponse.JsonFields.JSON_THING_ID); final String extractedFeatureId = jsonObject.getValueOrThrow(JSON_FEATURE_ID); final String extractedPointerString = jsonObject.getValueOrThrow(JSON_PROPERTY); final JsonPointer extractedPointer = JsonFactory.newPointer(extractedPointerString); final JsonValue extractedFeatureProperty = jsonObject.getValueOrThrow(JSON_VALUE); return of(thingId, extractedFeatureId, extractedPointer, extractedFeatureProperty, dittoHeaders); }); }
/** * Creates a response to a {@link RetrieveFeatureProperty} command from a JSON object. * * @param jsonObject the JSON object of which the response is to be created. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static RetrieveFeaturePropertyResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandResponseJsonDeserializer<RetrieveFeaturePropertyResponse>(TYPE, jsonObject) .deserialize((statusCode) -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommandResponse.JsonFields.JSON_THING_ID); final String extractedFeatureId = jsonObject.getValueOrThrow(JSON_FEATURE_ID); final String extractedPointerString = jsonObject.getValueOrThrow(JSON_PROPERTY); final JsonPointer extractedPointer = JsonFactory.newPointer(extractedPointerString); final JsonValue extractedFeatureProperty = jsonObject.getValueOrThrow(JSON_VALUE); return of(thingId, extractedFeatureId, extractedPointer, extractedFeatureProperty, dittoHeaders); }); }
adaptable -> RetrieveFeaturePropertyResponse.of(thingIdFrom(adaptable), featureIdFrom(adaptable), featurePropertyPointerFrom(adaptable), featurePropertyValueFrom(adaptable),
adaptable -> RetrieveFeaturePropertyResponse.of(thingIdFrom(adaptable), featureIdFrom(adaptable), featurePropertyPointerFrom(adaptable), featurePropertyValueFrom(adaptable),