本文整理匯總了Java中io.grpc.MethodDescriptor.PrototypeMarshaller類的典型用法代碼示例。如果您正苦於以下問題:Java PrototypeMarshaller類的具體用法?Java PrototypeMarshaller怎麽用?Java PrototypeMarshaller使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PrototypeMarshaller類屬於io.grpc.MethodDescriptor包,在下文中一共展示了PrototypeMarshaller類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: marshallerPrototype
import io.grpc.MethodDescriptor.PrototypeMarshaller; //導入依賴的package包/類
private static Optional<Message> marshallerPrototype(Marshaller<?> marshaller) {
if (marshaller instanceof PrototypeMarshaller) {
Object prototype = ((PrototypeMarshaller) marshaller).getMessagePrototype();
if (prototype instanceof Message) {
return Optional.of((Message) prototype);
}
}
return Optional.empty();
}
示例2: introspection
import io.grpc.MethodDescriptor.PrototypeMarshaller; //導入依賴的package包/類
@Test
public void introspection() throws Exception {
Marshaller<Enum> enumMarshaller = ProtoLiteUtils.marshaller(Enum.getDefaultInstance());
PrototypeMarshaller<Enum> prototypeMarshaller = (PrototypeMarshaller<Enum>) enumMarshaller;
assertSame(Enum.getDefaultInstance(), prototypeMarshaller.getMessagePrototype());
assertSame(Enum.class, prototypeMarshaller.getMessageClass());
}
示例3: marshallerType
import io.grpc.MethodDescriptor.PrototypeMarshaller; //導入依賴的package包/類
private static MessageType marshallerType(Marshaller<?> marshaller) {
return marshaller instanceof PrototypeMarshaller ? MessageType.PROTOBUF : MessageType.UNKNOWN;
}