Top Description Inners Constructors Methods
com.google.protobuf

public final Class RpcUtil

extends Object
Class Inheritance

Grab-bag of utility functions useful when dealing with RPCs.
Author
[email protected] Kenton Varda

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
RpcUtil.AlreadyCalledException

Exception thrown when a one-time callback is called more than once.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static <Type extends Message> Type
copyAsType(final Type typeDefaultInstance, final Message source)

Creates a new message of type "Type" which is a copy of "source".

public static <Type extends Message> RpcCallback<Message>
generalizeCallback(final RpcCallback<Type> originalCallback, final Class<Type> originalClass, final Type defaultInstance)

Take an RpcCallback accepting a specific message type and convert it to an RpcCallback<Message>.

public static <ParameterType> RpcCallback<ParameterType>
newOneTimeCallback(final RpcCallback<ParameterType> originalCallback)

Creates a callback which can only be called once.

public static <Type extends Message> RpcCallback<Type>
specializeCallback(final RpcCallback<Message> originalCallback)

Take an RpcCallback<Message> and convert it to an RpcCallback accepting a specific message type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RpcUtilback to summary
private RpcUtil()

Method Detail

copyAsTypeback to summary
private static <Type extends Message> Type copyAsType(final Type typeDefaultInstance, final Message source)

Creates a new message of type "Type" which is a copy of "source". "source" must have the same descriptor but may be a different class (e.g. DynamicMessage).

Annotations
@SuppressWarnings:unchecked
generalizeCallbackback to summary
public static <Type extends Message> RpcCallback<Message> generalizeCallback(final RpcCallback<Type> originalCallback, final Class<Type> originalClass, final Type defaultInstance)

Take an RpcCallback accepting a specific message type and convert it to an RpcCallback<Message>. The generalized callback will accept any message object which has the same descriptor, and will convert it to the correct class before calling the original callback. However, if the generalized callback is given a message with a different descriptor, an exception will be thrown.

newOneTimeCallbackback to summary
public static <ParameterType> RpcCallback<ParameterType> newOneTimeCallback(final RpcCallback<ParameterType> originalCallback)

Creates a callback which can only be called once. This may be useful for security, when passing a callback to untrusted code: most callbacks do not expect to be called more than once, so doing so may expose bugs if it is not prevented.

specializeCallbackback to summary
public static <Type extends Message> RpcCallback<Type> specializeCallback(final RpcCallback<Message> originalCallback)

Take an RpcCallback<Message> and convert it to an RpcCallback accepting a specific message type. This is always type-safe (parameter type contravariance).

Annotations
@SuppressWarnings:unchecked
com.google.protobuf back to summary

public final Class RpcUtil.AlreadyCalledException

extends RuntimeException
Class Inheritance

Exception thrown when a one-time callback is called more than once.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

AlreadyCalledExceptionback to summary
public AlreadyCalledException()