本文整理汇总了Java中com.google.protos.ipc.invalidation.ClientProtocol.ClientToServerMessage.hasInitializeMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ClientToServerMessage.hasInitializeMessage方法的具体用法?Java ClientToServerMessage.hasInitializeMessage怎么用?Java ClientToServerMessage.hasInitializeMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.protos.ipc.invalidation.ClientProtocol.ClientToServerMessage
的用法示例。
在下文中一共展示了ClientToServerMessage.hasInitializeMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasField
import com.google.protos.ipc.invalidation.ClientProtocol.ClientToServerMessage; //导入方法依赖的package包/类
/** Returns whether {@code field} is present in {@code message}. */
@Override
@SuppressWarnings("unchecked")
public boolean hasField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
ClientToServerMessage message = (ClientToServerMessage) rawMessage;
if (field == HEADER) {
return message.hasHeader();
}
if (field == INITIALIZE_MESSAGE) {
return message.hasInitializeMessage();
}
if (field == REGISTRATION_MESSAGE) {
return message.hasRegistrationMessage();
}
if (field == REGISTRATION_SYNC_MESSAGE) {
return message.hasRegistrationSyncMessage();
}
if (field == INVALIDATION_ACK_MESSAGE) {
return message.hasInvalidationAckMessage();
}
if (field == INFO_MESSAGE) {
return message.hasInfoMessage();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例2: toCompactString
import com.google.protos.ipc.invalidation.ClientProtocol.ClientToServerMessage; //导入方法依赖的package包/类
/**
* If {@code printHighFrequencyMessages} is true, logs sub-messages that are exchanged at a high
* frequency between the client and the registrar, e.g., invalidation ack message, heartbeat
* message.
*/
public static TextBuilder toCompactString(TextBuilder builder,
ClientToServerMessage msg, boolean printHighFrequencyMessages) {
// Print the header and any sub-messages in the message.
toCompactString(builder, msg.getHeader());
builder.append(',');
if (msg.hasInitializeMessage()) {
toCompactString(builder, msg.getInitializeMessage());
builder.append(',');
}
if (msg.hasRegistrationMessage()) {
toCompactString(builder, msg.getRegistrationMessage());
builder.append(',');
}
if (msg.hasRegistrationSyncMessage()) {
toCompactString(builder, msg.getRegistrationSyncMessage());
builder.append(',');
}
if (printHighFrequencyMessages && msg.hasInvalidationAckMessage()) {
toCompactString(builder, msg.getInvalidationAckMessage());
builder.append(',');
}
if (printHighFrequencyMessages && msg.hasInfoMessage()) {
toCompactString(builder, msg.getInfoMessage());
builder.append(',');
}
return builder;
}
示例3: postValidate
import com.google.protos.ipc.invalidation.ClientProtocol.ClientToServerMessage; //导入方法依赖的package包/类
@Override
public boolean postValidate(MessageLite message) {
ClientToServerMessage parsedMessage = (ClientToServerMessage) message;
// The message either has an initialize request from the client or it has the client token.
return (parsedMessage.hasInitializeMessage() ^ parsedMessage.getHeader().hasClientToken());
}