/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.PutIfAbsentRequest putIfAbsentRequest = 34;</code> */ public Builder mergePutIfAbsentRequest(org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest value) { if (putIfAbsentRequestBuilder_ == null) { if (messageTypeCase_ == 34 && messageType_ != org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.getDefaultInstance()) { messageType_ = org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.newBuilder((org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest) messageType_) .mergeFrom(value).buildPartial(); } else { messageType_ = value; } onChanged(); } else { if (messageTypeCase_ == 34) { putIfAbsentRequestBuilder_.mergeFrom(value); } putIfAbsentRequestBuilder_.setMessage(value); } messageTypeCase_ = 34; return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest)) { return super.equals(obj); } org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest other = (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest) obj; boolean result = true; result = result && getRegionName() .equals(other.getRegionName()); result = result && (hasEntry() == other.hasEntry()); if (hasEntry()) { result = result && getEntry() .equals(other.getEntry()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest buildPartial() { org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest result = new org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest(this); result.regionName_ = regionName_; if (entryBuilder_ == null) { result.entry_ = entry_; } else { result.entry_ = entryBuilder_.build(); } onBuilt(); return result; }
case 34: result = result && getPutIfAbsentRequest() .equals(other.getPutIfAbsentRequest()); break; case 35:
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.PutIfAbsentRequest putIfAbsentRequest = 34;</code> */ private com.google.protobuf.SingleFieldBuilderV3< org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest, org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.Builder, org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequestOrBuilder> getPutIfAbsentRequestFieldBuilder() { if (putIfAbsentRequestBuilder_ == null) { if (!(messageTypeCase_ == 34)) { messageType_ = org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.getDefaultInstance(); } putIfAbsentRequestBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest, org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.Builder, org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequestOrBuilder>( (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest) messageType_, getParentForChildren(), isClean()); messageType_ = null; } messageTypeCase_ = 34; onChanged();; return putIfAbsentRequestBuilder_; }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getRegionNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, regionName_); } if (entry_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, getEntry()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.PutIfAbsentRequest putIfAbsentRequest = 34;</code> */ public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest getPutIfAbsentRequest() { if (putIfAbsentRequestBuilder_ == null) { if (messageTypeCase_ == 34) { return (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest) messageType_; } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.getDefaultInstance(); } else { if (messageTypeCase_ == 34) { return putIfAbsentRequestBuilder_.getMessage(); } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.getDefaultInstance(); } } /**
@Override public Result<RegionAPI.PutIfAbsentResponse> process( ProtobufSerializationService serializationService, RegionAPI.PutIfAbsentRequest request, MessageExecutionContext messageExecutionContext) throws InvalidExecutionContextException, ConnectionStateException, EncodingException, DecodingException { final String regionName = request.getRegionName(); final BasicTypes.Entry entry = request.getEntry(); Object decodedValue = serializationService.decode(entry.getValue()); Object decodedKey = serializationService.decode(entry.getKey()); final Object oldValue = messageExecutionContext.getSecureCache().putIfAbsent(regionName, decodedKey, decodedValue); return Success.of(RegionAPI.PutIfAbsentResponse.newBuilder() .setOldValue(serializationService.encode(oldValue)).build()); } }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + REGIONNAME_FIELD_NUMBER; hash = (53 * hash) + getRegionName().hashCode(); if (hasEntry()) { hash = (37 * hash) + ENTRY_FIELD_NUMBER; hash = (53 * hash) + getEntry().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.PutIfAbsentRequest putIfAbsentRequest = 34;</code> */ public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequestOrBuilder getPutIfAbsentRequestOrBuilder() { if ((messageTypeCase_ == 34) && (putIfAbsentRequestBuilder_ != null)) { return putIfAbsentRequestBuilder_.getMessageOrBuilder(); } else { if (messageTypeCase_ == 34) { return (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest) messageType_; } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.getDefaultInstance(); } } /**
private RegionAPI.PutIfAbsentRequest generateTestRequest(boolean includeRegion, boolean includeEntry) throws EncodingException { RegionAPI.PutIfAbsentRequest.Builder builder = RegionAPI.PutIfAbsentRequest.newBuilder(); if (includeRegion) { builder.setRegionName(TEST_REGION); } if (includeEntry) { BasicTypes.EncodedValue testKey = serializationService.encode(TEST_KEY); BasicTypes.EncodedValue testValue = serializationService.encode(TEST_VALUE); BasicTypes.Entry testEntry = ProtobufUtilities.createEntry(testKey, testValue); builder.setEntry(testEntry); } return builder.build(); }
/** * Creates a request object containing a RegionAPI.PutIfAbsentRequest * * @param region - Name of the region to put data in * @param entry - Encoded key,value pair, see createEntry in {@link ProtobufRequestUtilities} * @return Request object containing the passed params. */ public static ClientProtocol.Message createPutIfAbsentRequest(String region, BasicTypes.Entry entry) { RegionAPI.PutIfAbsentRequest putIfAbsentRequest = RegionAPI.PutIfAbsentRequest.newBuilder().setRegionName(region).setEntry(entry).build(); return ClientProtocol.Message.newBuilder().setPutIfAbsentRequest(putIfAbsentRequest).build(); }
@java.lang.Override public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest getDefaultInstanceForType() { return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.getDefaultInstance(); }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public Builder mergeFrom(org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest other) { if (other == org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.getDefaultInstance()) return this; if (!other.getRegionName().isEmpty()) { regionName_ = other.regionName_; onChanged(); } if (other.hasEntry()) { mergeEntry(other.getEntry()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test public void nullKeyPassedThrough() throws Exception { final RegionAPI.PutIfAbsentRequest request = RegionAPI.PutIfAbsentRequest.newBuilder() .setRegionName(TEST_REGION) .setEntry(ProtobufUtilities.createEntry(serializationService, null, TEST_VALUE)).build(); Result<RegionAPI.PutIfAbsentResponse> response = operationHandler.process(serializationService, request, TestExecutionContext.getNoAuthCacheExecutionContext(cacheStub)); assertNull(serializationService.decode(response.getMessage().getOldValue())); verify(regionMock).putIfAbsent(null, TEST_VALUE); }
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.PutIfAbsentRequest putIfAbsentRequest = 34;</code> */ public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest getPutIfAbsentRequest() { if (messageTypeCase_ == 34) { return (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest) messageType_; } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.PutIfAbsentRequest.getDefaultInstance(); } /**
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getRegionNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, regionName_); } if (entry_ != null) { output.writeMessage(2, getEntry()); } unknownFields.writeTo(output); }
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.Entry entry = 2;</code> */ public org.apache.geode.internal.protocol.protobuf.v1.BasicTypes.EntryOrBuilder getEntryOrBuilder() { return getEntry(); }
/** * <code>string regionName = 1;</code> */ public Builder clearRegionName() { regionName_ = getDefaultInstance().getRegionName(); onChanged(); return this; } /**