本文整理汇总了Java中com.google.protos.ipc.invalidation.ClientProtocol.ServerHeader.getClientToken方法的典型用法代码示例。如果您正苦于以下问题:Java ServerHeader.getClientToken方法的具体用法?Java ServerHeader.getClientToken怎么用?Java ServerHeader.getClientToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.protos.ipc.invalidation.ClientProtocol.ServerHeader
的用法示例。
在下文中一共展示了ServerHeader.getClientToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ParsedMessage
import com.google.protos.ipc.invalidation.ClientProtocol.ServerHeader; //导入方法依赖的package包/类
/** Constructs an instance from a {@code rawMessage}. */
ParsedMessage(ServerToClientMessage rawMessage) {
// For each field, assign it to the corresponding protobuf field if present, else null.
ServerHeader messageHeader = rawMessage.getHeader();
header = new ServerMessageHeader(messageHeader.getClientToken(),
messageHeader.hasRegistrationSummary() ? messageHeader.getRegistrationSummary() : null);
tokenControlMessage = rawMessage.hasTokenControlMessage() ?
rawMessage.getTokenControlMessage() : null;
invalidationMessage = rawMessage.hasInvalidationMessage() ?
rawMessage.getInvalidationMessage() : null;
registrationStatusMessage = rawMessage.hasRegistrationStatusMessage() ?
rawMessage.getRegistrationStatusMessage() : null;
registrationSyncRequestMessage = rawMessage.hasRegistrationSyncRequestMessage() ?
rawMessage.getRegistrationSyncRequestMessage() : null;
configChangeMessage = rawMessage.hasConfigChangeMessage() ?
rawMessage.getConfigChangeMessage() : null;
infoRequestMessage = rawMessage.hasInfoRequestMessage() ?
rawMessage.getInfoRequestMessage() : null;
errorMessage = rawMessage.hasErrorMessage() ? rawMessage.getErrorMessage() : null;
}
示例2: getField
import com.google.protos.ipc.invalidation.ClientProtocol.ServerHeader; //导入方法依赖的package包/类
/** Returns the {@code field} from {@code message}. */
@Override
@SuppressWarnings("unchecked")
public Object getField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
ServerHeader message = (ServerHeader) rawMessage;
if (field == PROTOCOL_VERSION) {
return message.getProtocolVersion();
}
if (field == CLIENT_TOKEN) {
return message.getClientToken();
}
if (field == REGISTRATION_SUMMARY) {
return message.getRegistrationSummary();
}
if (field == SERVER_TIME_MS) {
return message.getServerTimeMs();
}
if (field == MESSAGE_ID) {
return message.getMessageId();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}