Here are the examples of the java api com.google.protobuf.Message taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
752 Examples
19
Source : TemplateEvaluator.java
with Apache License 2.0
from ververica
with Apache License 2.0
from ververica
public String evaluate(Message message) {
for (FragmentEvaluator e : fragmentEvaluators) {
e.eval(builder, message);
}
final String result = builder.toString();
builder.delete(0, builder.length());
return result;
}
19
Source : ProtobufRouter.java
with Apache License 2.0
from ververica
with Apache License 2.0
from ververica
@Override
public void route(Message message, Downstream<Message> downstream) {
Address targetAddress = addressResolver.evaluate(message);
downstream.forward(targetAddress, message);
}
19
Source : AddressResolver.java
with Apache License 2.0
from ververica
with Apache License 2.0
from ververica
Address evaluate(Message message) {
FunctionType functionType = new FunctionType(functionNamespace.evaluate(message), functionName.evaluate(message));
return new Address(functionType, functionId.evaluate(message));
}
19
Source : ProtobufDynamicMessageLens.java
with Apache License 2.0
from ververica
with Apache License 2.0
from ververica
@Override
public Object apply(Message message) {
message = traverseToTheLastMessage(message);
return value.value(message);
}
19
Source : ProtobufDynamicMessageLens.java
with Apache License 2.0
from ververica
with Apache License 2.0
from ververica
/**
* Traverse the path from root to the last nested message. At each traversed depth follow the next
* FiledDescriptor specified in descriptorPath for that depth. The returned message would be the
* last Message which contains the desired value. For example the path defined by: {@code .a.b.c}
* would result with {@code b} returned.
*/
private Message traverseToTheLastMessage(Message root) {
for (PathFragmentDescriptor p : path) {
root = (Message) p.value(root);
}
return root;
}
19
Source : Utils.java
with GNU Lesser General Public License v3.0
from tronprotocol
with GNU Lesser General Public License v3.0
from tronprotocol
public static String formatMessageString(Message message) {
String result = JsonFormat.printToString(message, true);
return JsonFormatUtil.formatJson(result);
}
19
Source : WebSocketClientTest.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
private static void recv(int messageId, Message message) {
if (message instanceof CommonProto.HeartBeat_Resp_0) {
CommonProto.HeartBeat_Resp_0 resp = (CommonProto.HeartBeat_Resp_0) message;
System.out.println("hearBeat: " + resp.getTime());
} else if (message instanceof TestProto.Notice_Push_103) {
TestProto.Notice_Push_103 resp = (TestProto.Notice_Push_103) message;
System.out.println("notice:" + resp.getValue());
}
}
19
Source : ProtobufUtil.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public static Message parseMessage(Message message, byte[] bytes) throws InvalidProtocolBufferException {
return message.getParserForType().parseFrom(bytes);
}
19
Source : ProtobufUtil.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public static int getMessageId(Message message) {
return getMessageId(message.getClreplaced());
}
19
Source : ProtobufUtil.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public static int getMessageSize(Message message) {
return message.getSerializedSize();
}
19
Source : ServerPush.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public void asyncPush(Collection<SessionContext> sessionContexts, Message response) {
asyncPushToSessionContexts(sessionContexts, response);
}
19
Source : ServerPush.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public void asyncPush(Stream<SessionContext> sctxStream, Message response) {
asyncPushToSessionContexts(sctxStream, response);
}
19
Source : ServerPush.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public void asyncPushAll(Message response) {
asyncPushToAll(response);
}
19
Source : ServerPush.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public void push(Collection<SessionContext> sessionContexts, Message response) {
syncPushToSessionContexts(sessionContexts, response);
}
19
Source : ServerPush.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public void push(Stream<SessionContext> sctxStream, Message response) {
syncPushToSessionContexts(sctxStream, response);
}
19
Source : ServerPush.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public void pushAll(Message response) {
syncPushToAll(response);
}
19
Source : ServerPush.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public void push(SessionContext sessionContext, Message response) {
syncPushToSessionContext(sessionContext, response);
}
19
Source : ServerPush.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public void asyncPush(SessionContext sessionContext, Message response) {
asyncPushToSessionContext(sessionContext, response);
}
19
Source : RespProtobufMgr.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
@Override
protected void checkProto(Message messageTemplate) {
String protoName = messageTemplate.getClreplaced().getSimpleName().toLowerCase();
if (!protoName.contains(PREFIX_RESP) && !protoName.contains(PREFIX_PUSH))
throw new IllegalArgumentException("not resp proto -> " + messageTemplate.getClreplaced().getName());
}
19
Source : ReqProtobufMgr.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
@Override
protected void checkProto(Message messageTemplate) {
String protoName = messageTemplate.getClreplaced().getSimpleName().toLowerCase();
if (!protoName.contains(PREFIX_REQ))
throw new IllegalArgumentException("not req proto -> " + messageTemplate.getClreplaced().getName());
}
19
Source : Protobuf.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
public static Protobuf of(int id, Message message) {
return new Protobuf(id, message.toByteArray());
}
19
Source : AbstractMeterProtobufClient.java
with Apache License 2.0
from SwingFrog
with Apache License 2.0
from SwingFrog
private void sendReq(int messageId, Message message, Callback<? extends Message> callback) {
waitRespId = messageId;
waitCallback = callback;
write(messageId, message);
}
19
Source : SerializerUtil.java
with Apache License 2.0
from spring-avengers
with Apache License 2.0
from spring-avengers
public static Message pojo2Protobuf(Object arg) throws ProtobufException {
if (!(arg instanceof Message)) {
Message message = (Message) serializer.toProtobuf(arg);
arg = null;
return message;
}
return (Message) arg;
}
19
Source : SerializerUtil.java
with Apache License 2.0
from spring-avengers
with Apache License 2.0
from spring-avengers
public static Object protobuf2Pojo(Message arg, Clreplaced<? extends Object> returnType) throws ProtobufException {
if (!Message.clreplaced.isreplacedignableFrom(returnType)) {
return serializer.fromProtobuf(arg, returnType);
} else {
return arg;
}
}
19
Source : GrpcFutureUnaryCommand.java
with Apache License 2.0
from spring-avengers
with Apache License 2.0
from spring-avengers
/**
* @see io.github.saluki.grpc.client.internal.unary.GrpcHystrixCommand#run0(com.google.protobuf.Message,
* io.grpc.MethodDescriptor, java.lang.Integer,
* io.github.saluki.grpc.client.internal.unary.GrpcUnaryClientCall)
*/
@Override
protected Message run0(Message req, MethodDescriptor<Message, Message> methodDesc, Integer timeOut, GrpcUnaryClientCall clientCall) {
try {
return clientCall.unaryFuture(req, methodDesc).get(timeOut, TimeUnit.MILLISECONDS);
} catch (Throwable e) {
logger.error(e.getMessage(), e);
super.cacheCurrentServer();
if (e instanceof TimeoutException) {
RpcServiceException rpcService = new RpcServiceException(e, RpcErrorMsgConstant.SERVICE_TIMEOUT);
throw rpcService;
} else {
RpcServiceException rpcService = new RpcServiceException(e, RpcErrorMsgConstant.BIZ_DEFAULT_EXCEPTION);
throw rpcService;
}
}
}
19
Source : GrpcBlockingUnaryCommand.java
with Apache License 2.0
from spring-avengers
with Apache License 2.0
from spring-avengers
/**
* @see io.github.saluki.grpc.client.internal.unary.GrpcHystrixCommand#run0(com.google.protobuf.Message,
* io.grpc.MethodDescriptor, java.lang.Integer,
* io.github.saluki.grpc.client.internal.unary.GrpcUnaryClientCall)
*/
@Override
protected Message run0(Message req, MethodDescriptor<Message, Message> methodDesc, Integer timeOut, GrpcUnaryClientCall clientCall) {
try {
return clientCall.blockingUnaryResult(req, methodDesc);
} catch (Throwable e) {
logger.error(e.getMessage(), e);
super.cacheCurrentServer();
RpcServiceException rpcService = new RpcServiceException(e, RpcErrorMsgConstant.BIZ_DEFAULT_EXCEPTION);
throw rpcService;
}
}
19
Source : AbstractClientService.java
with Apache License 2.0
from sofastack
with Apache License 2.0
from sofastack
private <T extends Message> void onCanceled(final Message request, final RpcResponseClosure<T> done) {
if (done != null) {
try {
done.run(new Status(RaftError.ECANCELED, "RPC request was canceled by future."));
} catch (final Throwable t) {
LOG.error("Fail to run RpcResponseClosure, the request is {}.", request, t);
}
}
}
19
Source : ServiceUnderTestImpl.java
with Apache License 2.0
from Sixt
with Apache License 2.0
from Sixt
@Override
public Message sendRequest(String serviceMethod, Message request) throws RpcCallException {
return sendRequest(serviceMethod, request, null);
}
19
Source : ServiceMethod.java
with Apache License 2.0
from Sixt
with Apache License 2.0
from Sixt
public RESPONSE sendRequest(Message request) throws RpcCallException {
return sendRequest(request, null);
}
19
Source : ServiceImpersonator.java
with Apache License 2.0
from Sixt
with Apache License 2.0
from Sixt
/**
* Publish an event to kafka. We create one publisher per topic. Uses a null key.
*
* @param topic The topic to publish under
* @param event The event to publish
*/
public void publishEvent(String topic, Message event) {
publishEventWithKey(topic, null, event);
}
19
Source : ProtobufRpcRequest.java
with Apache License 2.0
from Sixt
with Apache License 2.0
from Sixt
/**
* Micro framework implementation that encapsulates the protobuf
* envelope and body for a request
*/
public clreplaced ProtobufRpcRequest {
private String serviceMethod;
private Long sequenceNumber;
private Message payload;
public ProtobufRpcRequest(String serviceMethod, Message payload) {
this.serviceMethod = serviceMethod;
this.payload = payload;
}
public Message getPayload() {
return payload;
}
public byte[] getProtobufData() {
byte[] envelopeData = getEnvelope().toByteArray();
byte[] payloadData = getPayload().toByteArray();
int size = envelopeData.length + payloadData.length + 8;
byte[] retval = new byte[size];
int offset = 0;
System.arraycopy(Ints.toByteArray(envelopeData.length), 0, retval, offset, 4);
offset += 4;
System.arraycopy(envelopeData, 0, retval, offset, envelopeData.length);
offset += envelopeData.length;
System.arraycopy(Ints.toByteArray(payloadData.length), 0, retval, offset, 4);
offset += 4;
System.arraycopy(payloadData, 0, retval, offset, payloadData.length);
return retval;
}
private RpcEnvelope.Request getEnvelope() {
RpcEnvelope.Request.Builder builder = RpcEnvelope.Request.newBuilder().setServiceMethod(serviceMethod);
if (sequenceNumber != null) {
builder.setSequenceNumber(sequenceNumber);
}
return builder.build();
}
}
19
Source : Consortium.java
with BSD 3-Clause "New" or "Revised" License
from salesforce
with BSD 3-Clause "New" or "Revised" License
from salesforce
public HashKey submit(BiConsumer<Object, Throwable> onCompletion, Message transaction) throws TimeoutException {
return submit(false, onCompletion, transaction);
}
19
Source : Avalanche.java
with BSD 3-Clause "New" or "Revised" License
from salesforce
with BSD 3-Clause "New" or "Revised" License
from salesforce
/**
* Submit a transaction to the group.
*
* @param data - the transaction content
* @return the HashKey of the transaction, null if invalid
*/
public HashKey submitTransaction(Message data) {
return submitTransaction(data, null);
}
19
Source : ProtobufSerializer.java
with MIT License
from quantranuk
with MIT License
from quantranuk
/**
* Get the size (in number of bytes) of a fully serialized protobut message, including all the header information.
* @param message the protobuf message
* @return the size of a fully serialized message in bytes (including the header size)
*/
public static int getSerializedSize(Message message) {
return HEADER_LENGTH + message.getClreplaced().getName().length() + message.getSerializedSize();
}
19
Source : RecordStoreClient.java
with Apache License 2.0
from PierreZ
with Apache License 2.0
from PierreZ
public ListenableFuture<RecordStoreProtocol.EmptyResponse> putRecord(Message record) {
return this.putRecord(record.getClreplaced().getSimpleName(), record.toByteArray());
}
19
Source : ProtoMessageBuilder.java
with Apache License 2.0
from Netflix
with Apache License 2.0
from Netflix
static FieldDescriptor getAndreplacedertField(Message message, String name) {
return getAndreplacedertField(message.getDescriptorForType(), name);
}
19
Source : ProtobufCopyTest.java
with Apache License 2.0
from Netflix
with Apache License 2.0
from Netflix
public clreplaced ProtobufCopyTest {
private static Message OUTER_VALUE;
@BeforeClreplaced
public static void setUp() throws Exception {
Message innerValue = ProtoMessageBuilder.newInner("innerValue1", "innerValue2");
Message innerValue2 = ProtoMessageBuilder.newInner("inner2Value1", "inner2Value2");
OUTER_VALUE = ProtoMessageBuilder.newOuter(innerValue, 10, innerValue, innerValue2);
}
@Test
public void testTopLevelFieldSelection() throws Exception {
// Include all fields
Message all = ProtobufExt.copy(OUTER_VALUE, replacedet("objectField", "primitiveField"));
FieldDescriptor objectField = ProtoMessageBuilder.getAndreplacedertField(OUTER_VALUE, "objectField");
FieldDescriptor primitiveField = ProtoMessageBuilder.getAndreplacedertField(OUTER_VALUE, "primitiveField");
replacedertFieldHasValue(all, objectField);
replacedertFieldHasValue(all, primitiveField);
// Include only second field
Message secondOnly = ProtobufExt.copy(OUTER_VALUE, replacedet("primitiveField"));
replacedertFieldHasNoValue(secondOnly, objectField);
replacedertFieldHasValue(secondOnly, primitiveField);
}
@Test
public void testNestedSimpleFieldSelection() throws Exception {
Message filtered = ProtobufExt.copy(OUTER_VALUE, replacedet("objectField.stringField1", "primitiveField"));
FieldDescriptor objectField = ProtoMessageBuilder.getAndreplacedertField(OUTER_VALUE, "objectField");
FieldDescriptor primitiveField = ProtoMessageBuilder.getAndreplacedertField(OUTER_VALUE, "primitiveField");
FieldDescriptor objectArrayField = ProtoMessageBuilder.getAndreplacedertField(OUTER_VALUE, "objectArrayField");
FieldDescriptor stringField1 = ProtoMessageBuilder.getAndreplacedertField(objectField.getMessageType(), "stringField1");
FieldDescriptor stringField2 = ProtoMessageBuilder.getAndreplacedertField(objectField.getMessageType(), "stringField2");
replacedertFieldHasValue(filtered, objectField);
replacedertFieldHasValue((Message) filtered.getField(objectField), stringField1);
replacedertFieldHasNoValue((Message) filtered.getField(objectField), stringField2);
replacedertFieldHasValue(filtered, primitiveField);
replacedertFieldHasNoValue(filtered, objectArrayField);
}
@Test
public void testCollectionFieldSelection() throws Exception {
Message filtered = ProtobufExt.copy(OUTER_VALUE, replacedet("objectArrayField", "primitiveField"));
FieldDescriptor objectField = OUTER_VALUE.getDescriptorForType().findFieldByName("objectField");
FieldDescriptor primitiveField = OUTER_VALUE.getDescriptorForType().findFieldByName("primitiveField");
FieldDescriptor objectArrayField = OUTER_VALUE.getDescriptorForType().findFieldByName("objectArrayField");
FieldDescriptor stringField1 = ProtoMessageBuilder.getAndreplacedertField(objectField.getMessageType(), "stringField1");
FieldDescriptor stringField2 = ProtoMessageBuilder.getAndreplacedertField(objectField.getMessageType(), "stringField2");
replacedertFieldHasNoValue(filtered, objectField);
replacedertFieldHasValue(filtered, primitiveField);
replacedertFieldHasValue(filtered, objectArrayField);
Collection<Message> collection = (Collection<Message>) filtered.getField(objectArrayField);
replacedertThat(collection).hreplacedize(2);
for (Message inner : collection) {
replacedertFieldHasValue(inner, stringField1);
replacedertFieldHasValue(inner, stringField2);
}
}
@Test
public void testNestedCollectionFieldSelection() throws Exception {
Message filtered = ProtobufExt.copy(OUTER_VALUE, replacedet("objectArrayField.stringField1", "primitiveField"));
FieldDescriptor objectField = OUTER_VALUE.getDescriptorForType().findFieldByName("objectField");
FieldDescriptor objectArrayField = OUTER_VALUE.getDescriptorForType().findFieldByName("objectArrayField");
FieldDescriptor stringField1 = ProtoMessageBuilder.getAndreplacedertField(objectField.getMessageType(), "stringField1");
FieldDescriptor stringField2 = ProtoMessageBuilder.getAndreplacedertField(objectField.getMessageType(), "stringField2");
replacedertFieldHasNoValue(filtered, objectField);
replacedertFieldHasValue(filtered, objectArrayField);
Collection<Message> collection = (Collection<Message>) filtered.getField(objectArrayField);
for (Message inner : collection) {
replacedertFieldHasValue(inner, stringField1);
replacedertFieldHasNoValue(inner, stringField2);
}
}
private void replacedertFieldHasValue(Message enreplacedy, FieldDescriptor field) {
Object value = enreplacedy.getField(field);
replacedertThat(value).isNotNull();
if (value instanceof DynamicMessage) {
replacedertThat(((DynamicMessage) value).getAllFields()).isNotEmpty();
} else if (value instanceof Collection) {
replacedertThat((Collection) value).isNotEmpty();
} else {
replacedertThat(value).isNotNull();
}
}
private void replacedertFieldHasNoValue(Message enreplacedy, FieldDescriptor field) {
Object value = enreplacedy.getField(field);
if (value != null) {
if (value instanceof DynamicMessage) {
replacedertThat(((DynamicMessage) value).getAllFields()).isEmpty();
} else if (value instanceof String) {
replacedertThat(value).isEqualTo("");
} else if (value instanceof Collection) {
replacedertThat((Collection) value).isEmpty();
} else {
fail("Expected null value for field " + field);
}
}
}
}
19
Source : ApiClient.java
with Apache License 2.0
from librespot-org
with Apache License 2.0
from librespot-org
@NotNull
private static RequestBody protoBody(@NotNull Message msg) {
return new RequestBody() {
@Override
public MediaType contentType() {
return MediaType.get("application/protobuf");
}
@Override
public void writeTo(@NotNull BufferedSink sink) throws IOException {
sink.write(msg.toByteArray());
}
};
}
19
Source : Player.java
with MIT License
from jzyong
with MIT License
from jzyong
/**
* 发送udp
* @author JiangZhiYong
* @QQ 359135103
* 2017年10月20日 下午1:37:53
* @param msg
*/
public void sendUdpMsg(Message msg) {
if (!udpLogin) {
sendTcpMsg(msg);
return;
}
getUdpSession().write(msg);
}
19
Source : Player.java
with MIT License
from jzyong
with MIT License
from jzyong
public void sendTcpMsg(Message msg) {
getTcpSession().write(msg);
}
19
Source : MsgUtil.java
with MIT License
from jzyong
with MIT License
from jzyong
/**
* 消息ID
*
* @param message
* @return
*/
public static int getMessageID(final Message message) {
Descriptors.EnumValueDescriptor field = (Descriptors.EnumValueDescriptor) message.getField(message.getDescriptorForType().findFieldByNumber(1));
int msgID = field.getNumber();
// if (msgID < 99999) {
// log.warn("消息类型异常{},id{}", message.getClreplaced().getName(), msgID);
// }
return msgID;
}
19
Source : TcpHandler.java
with MIT License
from jzyong
with MIT License
from jzyong
/**
* Tcp 处理器
* <br>也可能处理udp请求
*
* @author JiangZhiYong
* @mail [email protected]
* @version $Id: $Id
*/
public abstract clreplaced TcpHandler extends AbsHandler {
private Message message;
// 角色ID
protected long rid;
// 角色
protected Person person;
/**
* {@inheritDoc}
*/
@Override
public Message getMessage() {
return message;
}
/**
* 获取消息
*
* @param <T> a T object.
* @return a T object.
*/
@SuppressWarnings("unchecked")
public <T extends Message> T getMsg() {
return (T) message;
}
/**
* <p>Getter for the field <code>person</code>.</p>
*
* @param <T> a T object.
* @return a T object.
*/
@SuppressWarnings("unchecked")
public <T extends Person> T getPerson() {
return (T) person;
}
/**
* <p>Setter for the field <code>person</code>.</p>
*
* @param person a {@link com.jzy.game.engine.struct.Person} object.
*/
public void setPerson(Person person) {
this.person = person;
}
/**
* {@inheritDoc}
*/
@Override
public void setMessage(Object message) {
this.message = (Message) message;
}
/**
* <p>Getter for the field <code>rid</code>.</p>
*
* @return a long.
*/
public long getRid() {
return rid;
}
/**
* <p>Setter for the field <code>rid</code>.</p>
*
* @param rid a long.
*/
public void setRid(long rid) {
this.rid = rid;
}
/**
* 发送带ID的消息
*
* @param object a {@link java.lang.Object} object.
*/
public void sendIdMsg(Object object) {
if (getSession() != null && getSession().isConnected()) {
getSession().write(new IDMessage(session, object, rid));
} else if (getChannel() != null && getChannel().isActive()) {
getChannel().writeAndFlush(new IDMessage(channel, object, rid, null));
}
}
}
19
Source : Utils.java
with Apache License 2.0
from JulongChain
with Apache License 2.0
from JulongChain
public static byte[] marshalOrPanic(Message pb) {
byte[] data = pb.toByteArray();
return data;
}
19
Source : CommonUtils.java
with Apache License 2.0
from JulongChain
with Apache License 2.0
from JulongChain
public static byte[] marshal(Message message) {
return message.toByteArray();
}
19
Source : CommonUtils.java
with Apache License 2.0
from JulongChain
with Apache License 2.0
from JulongChain
public static Common.GroupHeader unmarshalEnvelopeOfTypes(Common.Envelope envelope, Common.HeaderType[] expectedHeaderTypes, Message message) throws InvalidProtocolBufferException {
Common.Payload payload = unmarshalPayload(envelope.getPayload().toByteArray());
if (payload.getHeader() == null) {
log.error("Envelope must have a Header");
}
Common.GroupHeader chdr = unmarshalGroupHeader(payload.getHeader().getGroupHeader().toByteArray());
boolean headerTypeMatched = false;
for (int i = 0; i < expectedHeaderTypes.length; i++) {
if (chdr.getType() == expectedHeaderTypes[i].getNumber()) {
headerTypeMatched = true;
break;
}
}
return chdr;
}
19
Source : CommonUtils.java
with Apache License 2.0
from JulongChain
with Apache License 2.0
from JulongChain
public static byte[] marshlOrPanic(Message message) {
return marshal(message);
}
19
Source : CommonUtils.java
with Apache License 2.0
from JulongChain
with Apache License 2.0
from JulongChain
public static Common.GroupHeader unmarshalEnvelopeOfType(Common.Envelope envelope, Common.HeaderType headerType, Message message) throws InvalidProtocolBufferException {
return unmarshalEnvelopeOfTypes(envelope, new Common.HeaderType[] { headerType }, message);
}
19
Source : StandardConfigValue.java
with Apache License 2.0
from JulongChain
with Apache License 2.0
from JulongChain
/**
* 标准配置项/配置值
*
* @author zhouhui
* @date 2018/3/9
* @company Dingxuan
*/
public clreplaced StandardConfigValue implements IConfigValue {
protected String key;
protected Message value;
@Override
public String getKey() {
return key;
}
@Override
public Message getValue() {
return value;
}
}
19
Source : XmlFormat.java
with Apache License 2.0
from jigsaw-projects
with Apache License 2.0
from jigsaw-projects
private void print(Message message, XmlGenerator generator) throws IOException {
for (Map.Entry<FieldDescriptor, Object> field : message.getAllFields().entrySet()) {
printField(field.getKey(), field.getValue(), generator);
}
printUnknownFields(message.getUnknownFields(), generator);
}
19
Source : XmlFormat.java
with Apache License 2.0
from jigsaw-projects
with Apache License 2.0
from jigsaw-projects
/**
* Outputs a textual representation of the Protocol Message supplied into the parameter output.
* (This representation is the new version of the clreplacedic "ProtocolPrinter" output from the
* original Protocol Buffer system)
*/
public void print(final Message message, Appendable output) throws IOException {
XmlGenerator generator = new XmlGenerator(output);
final String messageName = message.getDescriptorForType().getName();
generator.print("<");
generator.print(messageName);
generator.print(">");
print(message, generator);
generator.print("</");
generator.print(messageName);
generator.print(">");
}
See More Examples