Github user kohlmu-pivotal commented on a diff in the pull request: https://github.com/apache/geode/pull/630#discussion_r127294096 --- Diff: geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java --- @@ -133,21 +134,38 @@ /** * This will return the object encoded in a protobuf EncodedValue - * * @param serializationService - object which knows how to encode objects for the protobuf - * protocol {@link ProtobufSerializationService} + * protocol {@link ProtobufSerializationService} * @param encodedValue - The value to be decoded * @return the object encoded in the passed encodedValue * @throws UnsupportedEncodingTypeException - There isn't a SerializationType matching the - * encodedValues type + * encodedValues type * @throws CodecNotRegisteredForTypeException - There isn't a protobuf codec for the - * SerializationType matching the encodedValues type + * SerializationType matching the encodedValues type */ public static Object decodeValue(SerializationService serializationService, - BasicTypes.EncodedValue encodedValue) + BasicTypes.EncodedValue encodedValue) throws UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException { BasicTypes.EncodingType encoding = encodedValue.getEncodingType(); byte[] bytes = encodedValue.getValue().toByteArray(); return serializationService.decode(encoding, bytes); } + + public static BasicTypes.Region createRegionMessageFromRegion(Region region) { + RegionAttributes regionAttributes = region.getAttributes(); + BasicTypes.Region.Builder protoRegionBuilder = BasicTypes.Region.newBuilder(); + + protoRegionBuilder.setName(region.getName()); + protoRegionBuilder.setSize(region.size()); + + protoRegionBuilder.setPersisted(regionAttributes.getDataPolicy().withPersistence()); + protoRegionBuilder.setKeyConstraint(regionAttributes.getKeyConstraint() == null ? "" --- End diff -- Correct. Amended according for both Key and Value constraint
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---