@Override public RetrieveFeaturePropertyResponse setDittoHeaders(final DittoHeaders dittoHeaders) { return of(thingId, featureId, propertyPointer, propertyValue, dittoHeaders); }
@Override public RetrieveFeaturePropertyResponse setDittoHeaders(final DittoHeaders dittoHeaders) { return of(thingId, featureId, propertyPointer, propertyValue, dittoHeaders); }
@Override public RetrieveFeaturePropertyResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, featureId, propertyPointer, entity, getDittoHeaders()); }
@Override public RetrieveFeaturePropertyResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, featureId, propertyPointer, entity, getDittoHeaders()); }
@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),