frostfs-sdk-java/client/src/main/java/info/FrostFS/sdk/tools/MessageHelper.java
Bruk Ori ff5b007780 [#XX] code cleanup
update README.md
Signed-off-by: Ori Bruk <o.bruk@yadro.com>
2024-07-23 19:30:07 +03:00

15 lines
553 B
Java

package info.FrostFS.sdk.tools;
import com.google.protobuf.Message;
import com.google.protobuf.MessageOrBuilder;
public class MessageHelper {
public static Message getField(MessageOrBuilder messageOrBuilder, String fieldName) {
return (Message) messageOrBuilder.getField(messageOrBuilder.getDescriptorForType().findFieldByName(fieldName));
}
public static void setField(Message.Builder builder, String fieldName, Object value) {
builder.setField(builder.getDescriptorForType().findFieldByName(fieldName), value);
}
}