本文整理汇总了Java中com.google.protos.ipc.invalidation.ClientProtocol.ProtocolVersion类的典型用法代码示例。如果您正苦于以下问题:Java ProtocolVersion类的具体用法?Java ProtocolVersion怎么用?Java ProtocolVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProtocolVersion类属于com.google.protos.ipc.invalidation.ClientProtocol包,在下文中一共展示了ProtocolVersion类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasField
import com.google.protos.ipc.invalidation.ClientProtocol.ProtocolVersion; //导入依赖的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);
ProtocolVersion message = (ProtocolVersion) rawMessage;
if (field == VERSION) {
return message.hasVersion();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例2: getField
import com.google.protos.ipc.invalidation.ClientProtocol.ProtocolVersion; //导入依赖的package包/类
/** Returns the {@code field} from {@code message}. */
@Override
@SuppressWarnings("unchecked")
public Object getField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
ProtocolVersion message = (ProtocolVersion) rawMessage;
if (field == VERSION) {
return message.getVersion();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例3: toCompactString
import com.google.protos.ipc.invalidation.ClientProtocol.ProtocolVersion; //导入依赖的package包/类
public static TextBuilder toCompactString(TextBuilder builder,
ProtocolVersion protocolVersion) {
if (protocolVersion == null) {
return builder;
}
builder.appendFormat("%d.%d", protocolVersion.getVersion().getMajorVersion(),
protocolVersion.getVersion().getMinorVersion());
return builder;
}