public RpcRequestResponse translate(MethodDescriptor method, Message message, StreamCarryingRpcController controller) { // first convert the request to an RPC request Rpc.Builder msg = makeHeader(method.getName()); // add the request to the header GeneratedExtension<Rpc, Message> extension = extensions.getExtension(message); msg.setExtension(extension, message); // then create the actual rpc that will be sent RpcRequestResponse rpc = new RpcRequestResponse(msg); if (controller != null && controller.getOutboundTrailer() != null) { rpc.setData(controller.getOutboundTrailer(), controller.getOutboundTrailerLength()); } return rpc; }
public PseudoAction(UUID uuid, ActionOwner owner, NestedSet<Artifact> inputs, Collection<Artifact> outputs, String mnemonic, GeneratedExtension<ExtraActionInfo, InfoType> infoExtension, InfoType info) { super(owner, inputs, outputs); this.uuid = uuid; this.mnemonic = mnemonic; this.infoExtension = infoExtension; this.info = info; }
public PyPseudoAction(ActionOwner owner, NestedSet<Artifact> inputs, Collection<Artifact> outputs, String mnemonic, GeneratedExtension<ExtraActionInfo, PythonInfo> infoExtension, PythonInfo info) { super(ACTION_UUID, owner, inputs, outputs, mnemonic, infoExtension, info); }
protected ExtraActionInfoSupplier(GeneratedExtension<ExtraActionInfo, T> extension, T value) { this.extension = extension; this.value = value; }
public <T> Builder setExtraActionInfo( GeneratedExtension<ExtraActionInfo, T> extension, T value) { this.extraActionInfoSupplier = new ExtraActionInfoSupplier<>(extension, value); return this; }
/** Check if a singular extension is present. */ <Type> boolean hasExtension( GeneratedExtension<MessageType, Type> extension);
/** Get the number of elements in a repeated extension. */ <Type> int getExtensionCount( GeneratedExtension<MessageType, List<Type>> extension);
/** Get the value of an extension. */ <Type> Type getExtension( GeneratedExtension<MessageType, Type> extension);
/** Get one element of a repeated extension. */ <Type> Type getExtension( GeneratedExtension<MessageType, List<Type>> extension, int index);
/** Check if a singular extension is present. */ @Override public final <Type> boolean hasExtension( final GeneratedExtension<MessageType, Type> extension) { return hasExtension((ExtensionLite<MessageType, Type>) extension); }
/** Get the number of elements in a repeated extension. */ @Override public final <Type> int getExtensionCount( final GeneratedExtension<MessageType, List<Type>> extension) { return getExtensionCount((ExtensionLite<MessageType, List<Type>>) extension); }
/** Get the value of an extension. */ @Override public final <Type> Type getExtension( final GeneratedExtension<MessageType, Type> extension) { return getExtension((ExtensionLite<MessageType, Type>) extension); }
/** Get one element of a repeated extension. */ @Override public final <Type> Type getExtension( final GeneratedExtension<MessageType, List<Type>> extension, final int index) { return getExtension((ExtensionLite<MessageType, List<Type>>) extension, index); }
/** Get the value of an extension. */ @Override public final <Type> Type getExtension( final GeneratedExtension<MessageType, List<Type>> extension, final int index) { return getExtension((ExtensionLite<MessageType, List<Type>>) extension, index); }
/** Set the value of an extension. */ public <Type> BuilderType setExtension( final GeneratedExtension<MessageType, Type> extension, final Type value) { return setExtension((ExtensionLite<MessageType, Type>) extension, value); }
/** Set the value of one element of a repeated extension. */ public <Type> BuilderType setExtension( final GeneratedExtension<MessageType, List<Type>> extension, final int index, final Type value) { return setExtension((ExtensionLite<MessageType, List<Type>>) extension, index, value); }
/** Append a value to a repeated extension. */ public <Type> BuilderType addExtension( final GeneratedExtension<MessageType, List<Type>> extension, final Type value) { return addExtension((ExtensionLite<MessageType, List<Type>>) extension, value); }
/** Clear an extension. */ public <Type> BuilderType clearExtension( final GeneratedExtension<MessageType, ?> extension) { return clearExtension((ExtensionLite<MessageType, ?>) extension); }
public Test2Reader(GeneratedExtension<?, ?> key, String name) { super(key, true, name); }
public Test1Reader(GeneratedExtension<?, ?> key) { super(key, false, "test1"); }
/** * Translate from the external RPC message to the actual message embedded as an extension in * the Rpc message * * @param receivedMessage generic RPC received * @param prototype prototype of the message that we expect to receive * @return the twice wrapped underlying rpc message */ public Message translate(Rpc rpc, Message prototype) { // unwrap the underlying message, which should be bound to one of the extensions GeneratedMessage.GeneratedExtension<RpcMessages.Rpc, Message> responseExtension = extensions.getExtension(prototype); return rpc.getExtension(responseExtension); }
/** * Use this constructor for readers of message type. * * @param key Extension key * @param isJsonObject {@code true} if the extension value is desserialized from a JSON object * @param rootNameFilters Filter for the root names (direct fields of "ext"). * If empty, this reader will be invoked for any field. */ protected OpenRtbJsonExtComplexReader( GeneratedExtension<?, ?> key, boolean isJsonObject, String... rootNameFilters) { super(rootNameFilters); this.key = checkNotNull(key); this.isJsonObject = isJsonObject; }