/** * Returns a {@code Operation} object given the operation and producer identifiers. The * combination of producer and id must be globally unique. */ public static Operation of(String id, String producer) { return newBuilder(id, producer).build(); }
static Operation fromPb(LogEntryOperation operationPb) { return newBuilder(operationPb.getId(), operationPb.getProducer()) .setFirst(operationPb.getFirst()) .setLast(operationPb.getLast()) .build(); } }
@Test public void testToBuilder() { compareLogOperation(OPERATION, OPERATION.toBuilder().build()); Operation operation = OPERATION .toBuilder() .setId("newId") .setProducer("newProducer") .setFirst(false) .setLast(true) .build(); assertEquals("newId", operation.getId()); assertEquals("newProducer", operation.getProducer()); assertFalse(operation.first()); assertTrue(operation.last()); operation = operation.toBuilder().setId(ID).setProducer(PRODUCER).setFirst(FIRST).setLast(LAST).build(); compareLogOperation(OPERATION, operation); }
static Operation fromPb(LogEntryOperation operationPb) { return newBuilder(operationPb.getId(), operationPb.getProducer()) .setFirst(operationPb.getFirst()) .setLast(operationPb.getLast()) .build(); } }
/** * Returns a {@code Operation} object given the operation and producer identifiers. The * combination of producer and id must be globally unique. */ public static Operation of(String id, String producer) { return newBuilder(id, producer).build(); }