@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState)) { return super.equals(obj); } org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState other = (org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState) obj; boolean result = true; result = result && getKey() .equals(other.getKey()); result = result && getValue() .equals(other.getValue()); result = result && getCollection() .equals(other.getCollection()); return result; }
public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getKeyBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); } if (!value_.isEmpty()) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, value_); } if (!getCollectionBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, collection_); } memoizedSize = size; return size; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); hash = (37 * hash) + KEY_FIELD_NUMBER; hash = (53 * hash) + getKey().hashCode(); hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); hash = (37 * hash) + COLLECTION_FIELD_NUMBER; hash = (53 * hash) + getCollection().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * Check incoming message * If message type is PUT_STATE and payload equal to passed in constructor * @param msg message from chaincode * @return */ @Override public boolean expected(ChaincodeShim.ChaincodeMessage msg) { orgMsg = msg; ChaincodeShim.PutState putMsg = null; try { putMsg = ChaincodeShim.PutState.parseFrom(msg.getPayload()); } catch (InvalidProtocolBufferException e) { return false; } return val.equals(new String(putMsg.getValue().toByteArray(), StandardCharsets.UTF_8)) && msg.getType() == ChaincodeShim.ChaincodeMessage.Type.PUT_STATE; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public Builder mergeFrom(org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState other) { if (other == org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState.getDefaultInstance()) return this; if (!other.getKey().isEmpty()) { key_ = other.key_; onChanged(); } if (other.getValue() != com.google.protobuf.ByteString.EMPTY) { setValue(other.getValue()); } if (!other.getCollection().isEmpty()) { collection_ = other.collection_; onChanged(); } onChanged(); return this; }
public org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState getDefaultInstanceForType() { return org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState.getDefaultInstance(); }
public org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState buildPartial() { org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState result = new org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState(this); result.key_ = key_; result.value_ = value_; result.collection_ = collection_; onBuilt(); return result; }
public org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState build() { org.hyperledger.fabric.protos.peer.ChaincodeShim.PutState result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
/** * <code>optional string key = 1;</code> */ public Builder clearKey() { key_ = getDefaultInstance().getKey(); onChanged(); return this; } /**
/** * <code>optional bytes value = 2;</code> */ public Builder clearValue() { value_ = getDefaultInstance().getValue(); onChanged(); return this; }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getKeyBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); } if (!value_.isEmpty()) { output.writeBytes(2, value_); } if (!getCollectionBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, collection_); } }
private static ChaincodeMessage newPutStateEventMessage(final String channelId, final String txId, final String collection, final String key, final ByteString value) { return newEventMessage(PUT_STATE, channelId, txId, PutState.newBuilder() .setCollection(collection) .setKey(key) .setValue(value) .build().toByteString()); }
/** * <code>optional string collection = 3;</code> */ public Builder clearCollection() { collection_ = getDefaultInstance().getCollection(); onChanged(); return this; } /**