private static PolicyTag createElement(final PidWithSeqNr pidWithSeqNr) { final String id = pidWithSeqNr.getPersistenceId() .replaceFirst(PolicyPersistenceActor.PERSISTENCE_ID_PREFIX, ""); return PolicyTag.of(id, pidWithSeqNr.getSequenceNr()); } }
private static PolicyTag createElement(final PidWithSeqNr pidWithSeqNr) { final String id = pidWithSeqNr.getPersistenceId() .replaceFirst(PolicyPersistenceActor.PERSISTENCE_ID_PREFIX, ""); return PolicyTag.of(id, pidWithSeqNr.getSequenceNr()); } }
/** * Creates a new {@link PolicyReferenceTag} from a JSON object. * * @param jsonObject the JSON object of which a new {@link PolicyReferenceTag} is to be created. * @return the {@link PolicyReferenceTag} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws IllegalArgumentException if {@code jsonObject} is empty. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} is not valid JSON. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static PolicyReferenceTag fromJson(final JsonObject jsonObject) { final String extractedEntityId = jsonObject.getValueOrThrow(JsonFields.ENTITY_ID); final String extractedPolicyId = jsonObject.getValueOrThrow(JsonFields.POLICY_ID); final long extractedPolicyRev = jsonObject.getValueOrThrow(JsonFields.POLICY_REV); final PolicyTag extractedPolicyTag = PolicyTag.of(extractedPolicyId, extractedPolicyRev); return new PolicyReferenceTag(extractedEntityId, extractedPolicyTag); }
/** * Creates a new {@link PolicyReferenceTag} from a JSON object. * * @param jsonObject the JSON object of which a new {@link PolicyReferenceTag} is to be created. * @return the {@link PolicyReferenceTag} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws IllegalArgumentException if {@code jsonObject} is empty. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} is not valid JSON. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static PolicyReferenceTag fromJson(final JsonObject jsonObject) { final String extractedEntityId = jsonObject.getValueOrThrow(JsonFields.ENTITY_ID); final String extractedPolicyId = jsonObject.getValueOrThrow(JsonFields.POLICY_ID); final long extractedPolicyRev = jsonObject.getValueOrThrow(JsonFields.POLICY_REV); final PolicyTag extractedPolicyTag = PolicyTag.of(extractedPolicyId, extractedPolicyRev); return new PolicyReferenceTag(extractedEntityId, extractedPolicyTag); }