本文整理汇总了Java中com.google.protobuf.Internal.EnumLite类的典型用法代码示例。如果您正苦于以下问题:Java EnumLite类的具体用法?Java EnumLite怎么用?Java EnumLite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnumLite类属于com.google.protobuf.Internal包,在下文中一共展示了EnumLite类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkSend
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
public boolean checkSend(EnumLite send, Class<?> sendClass, Class<?> receiveClass) {
if (RpcConstants.EXTRA_DEBUGGING) {
logger.debug(String.format("Checking send classes for send RpcType %s. Send Class is %s and Receive class is %s.", send, sendClass, receiveClass));
}
RpcMessageType<?,?,?> type = sendMap.get(send);
if (type == null) {
throw new IllegalStateException(String.format("%s: There is no defined RpcMessage type for a Rpc send type of %s.", name, send));
}
if (type.getSend() != sendClass) {
throw new IllegalStateException(String.format("%s: The definition for send doesn't match implementation code. The definition is %s however the current send is trying to send an object of type %s.", name, type, sendClass.getCanonicalName()));
}
if (type.getRet() != receiveClass) {
throw new IllegalStateException(String.format("%s: The definition for send doesn't match implementation code. The definition is %s however the current send is trying to setup an expected reception of an object of type %s.", name, type, receiveClass.getCanonicalName()));
}
return true;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:19,代码来源:RpcConfig.java
示例2: SimpleProtocol
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public SimpleProtocol(int protocolId, Map<Integer, ReceiveHandler<MessageLite, MessageLite>> handlers, BufferAllocator allocator, String name) {
super();
this.protocolId = protocolId;
this.handlers = new ReceiveHandler[2048];
this.defaultResponseInstances = new MessageLite[2048];
this.defaultRequestInstances = new MessageLite[2048];
RpcConfigBuilder builder = RpcConfig.newBuilder()
.name(name)
.timeout(0);
for(Entry<Integer, ReceiveHandler<MessageLite, MessageLite>> e : handlers.entrySet()) {
final int id = e.getKey();
final ReceiveHandler<?,?> handler = e.getValue();
final EnumLite num = new PseudoEnum(id);
builder.add(num, (Class<? extends MessageLite>) handler.getDefaultRequest().getClass(), num, (Class<? extends MessageLite>) handler.getDefaultResponse().getClass());
this.handlers[id] = e.getValue();
this.defaultResponseInstances[id] = e.getValue().getDefaultResponse();
this.defaultRequestInstances[id] = e.getValue().getDefaultRequest();
}
this.config = builder.build();
this.allocator = allocator;
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:ProtocolBuilder.java
示例3: hashFields
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
/** Get a hash code for given fields and values, using the given seed. */
@SuppressWarnings("unchecked")
protected static int hashFields(int hash, Map<FieldDescriptor, Object> map) {
for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) {
FieldDescriptor field = entry.getKey();
Object value = entry.getValue();
hash = (37 * hash) + field.getNumber();
if (field.isMapField()) {
hash = (53 * hash) + hashMapField(value);
} else if (field.getType() != FieldDescriptor.Type.ENUM){
hash = (53 * hash) + value.hashCode();
} else if (field.isRepeated()) {
List<? extends EnumLite> list = (List<? extends EnumLite>) value;
hash = (53 * hash) + Internal.hashEnumList(list);
} else {
hash = (53 * hash) + Internal.hashEnum((EnumLite) value);
}
}
return hash;
}
开发者ID:reubenbrown13,项目名称:cfapi,代码行数:21,代码来源:AbstractMessage.java
示例4: process
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
@Override
public <S extends ServerConnection<S>, T extends EnumLite>
void process(SaslResponseContext<S, T> context) throws Exception {
final SaslMessage.Builder challenge = SaslMessage.newBuilder();
final SaslServer saslServer = context.connection.getSaslServer();
final byte[] challengeBytes = evaluateResponse(saslServer, context.saslResponse.getData().toByteArray());
if (saslServer.isComplete()) {
challenge.setStatus(SaslStatus.SASL_SUCCESS);
if (challengeBytes != null) {
challenge.setData(ByteString.copyFrom(challengeBytes));
}
handleSuccess(context, challenge, saslServer);
} else {
challenge.setStatus(SaslStatus.SASL_IN_PROGRESS)
.setData(ByteString.copyFrom(challengeBytes));
context.sender.send(new Response(context.saslResponseType, challenge.build()));
}
}
开发者ID:axbaretto,项目名称:drill,代码行数:22,代码来源:ServerAuthenticationHandler.java
示例5: hashFields
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
/** Get a hash code for given fields and values, using the given seed. */
@SuppressWarnings("unchecked")
protected int hashFields(int hash, Map<FieldDescriptor, Object> map) {
for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) {
FieldDescriptor field = entry.getKey();
Object value = entry.getValue();
hash = (37 * hash) + field.getNumber();
if (field.getType() != FieldDescriptor.Type.ENUM){
hash = (53 * hash) + value.hashCode();
} else if (field.isRepeated()) {
List<? extends EnumLite> list = (List<? extends EnumLite>) value;
hash = (53 * hash) + hashEnumList(list);
} else {
hash = (53 * hash) + hashEnum((EnumLite) value);
}
}
return hash;
}
开发者ID:bdceo,项目名称:bd-codes,代码行数:19,代码来源:AbstractMessage.java
示例6: hashFields
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
/** Get a hash code for given fields and values, using the given seed. */
@SuppressWarnings("unchecked")
protected static int hashFields(int hash, Map<FieldDescriptor, Object> map) {
for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) {
FieldDescriptor field = entry.getKey();
Object value = entry.getValue();
hash = (37 * hash) + field.getNumber();
if (field.getType() != FieldDescriptor.Type.ENUM){
hash = (53 * hash) + value.hashCode();
} else if (field.isRepeated()) {
List<? extends EnumLite> list = (List<? extends EnumLite>) value;
hash = (53 * hash) + Internal.hashEnumList(list);
} else {
hash = (53 * hash) + Internal.hashEnum((EnumLite) value);
}
}
return hash;
}
开发者ID:funkypandagame,项目名称:protoc-gen-as3,代码行数:19,代码来源:AbstractMessage.java
示例7: hashFields
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
/**
* Get a hash code for given fields and values, using the given seed.
*/
@SuppressWarnings("unchecked")
protected static int hashFields (int hash, Map<FieldDescriptor, Object> map) {
for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet ()) {
FieldDescriptor field = entry.getKey ();
Object value = entry.getValue ();
hash = (37 * hash) + field.getNumber ();
if (field.getType () != FieldDescriptor.Type.ENUM) {
hash = (53 * hash) + value.hashCode ();
} else if (field.isRepeated ()) {
List<? extends EnumLite> list = (List<? extends EnumLite>) value;
hash = (53 * hash) + Internal.hashEnumList (list);
} else {
hash = (53 * hash) + Internal.hashEnum ((EnumLite) value);
}
}
return hash;
}
开发者ID:BFergerson,项目名称:Beam,代码行数:21,代码来源:AbstractMessage.java
示例8: RpcConfig
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
private RpcConfig(String name, Map<EnumLite, RpcMessageType<?, ?, ?>> sendMap,
Map<Integer, RpcMessageType<?, ?, ?>> receiveMap, int timeout) {
this.name = name;
this.timeout = timeout;
this.sendMap = ImmutableMap.copyOf(sendMap);
this.receiveMap = ImmutableMap.copyOf(receiveMap);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:RpcConfig.java
示例9: checkResponseSend
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
public boolean checkResponseSend(EnumLite responseType, Class<?> responseClass) {
if (RpcConstants.EXTRA_DEBUGGING) {
logger.debug(String.format("Checking responce send of type %s with response class of %s.", responseType, responseClass));
}
RpcMessageType<?,?,?> type = receiveMap.get(responseType.getNumber());
if (type == null) {
throw new IllegalStateException(String.format("%s: There is no defined RpcMessage type for a Rpc response of type %s.", name, responseType));
}
if (type.getRet() != responseClass) {
throw new IllegalStateException(String.format("%s: The definition for the response doesn't match implementation code. The definition is %s however the current response is trying to response with an object of type %s.", name, type, responseClass.getCanonicalName()));
}
return true;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:15,代码来源:RpcConfig.java
示例10: throwIfOneofAlreadyWritten
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
/**
* Checks whether the oneof whose {@code oneofCase} has already been set. If so, an {@link
* InvalidProtocolBufferException} is thrown.
*/
static void throwIfOneofAlreadyWritten(Object oneofCase, String fieldName)
throws InvalidProtocolBufferException {
if (((EnumLite) oneofCase).getNumber() != 0) {
// TODO: Add the actual variableName of the offending field to the error message like
// upstream, not
// too hard but just a little boring for the expected return.
throw new InvalidProtocolBufferException(
"Cannot set field "
+ fieldName
+ " because another field "
+ oneofCase
+ " belonging to the same oneof has already been set.");
}
}
开发者ID:curioswitch,项目名称:curiostack,代码行数:19,代码来源:ParseSupport.java
示例11: RpcConfig
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
private RpcConfig(String name, Map<EnumLite, RpcMessageType<?, ?, ?>> sendMap,
Map<Integer, RpcMessageType<?, ?, ?>> receiveMap, int timeout, Executor executor) {
this.name = name;
this.timeout = timeout;
this.sendMap = ImmutableMap.copyOf(sendMap);
this.receiveMap = ImmutableMap.copyOf(receiveMap);
this.executor = executor;
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:RpcConfig.java
示例12: send
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
public <SEND extends MessageLite, RECEIVE extends MessageLite> void send(
RpcOutcomeListener<RECEIVE> outcomeListener,
EnumLite rpcType,
SEND protobufBody,
Class<RECEIVE> clazz,
ByteBuf... dataBodies) {
assert rpcConfig.checkSend(rpcType, protobufBody.getClass(), clazz);
connection.send(new ProxyListener<RECEIVE>(outcomeListener), RpcType.MESSAGE, msg(rpcType, protobufBody), FabricMessage.class, dataBodies);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:ProxyConnection.java
示例13: sendUnsafe
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
public <SEND extends MessageLite, RECEIVE extends MessageLite> void sendUnsafe(
RpcOutcomeListener<RECEIVE> outcomeListener,
EnumLite rpcType,
SEND protobufBody,
Class<RECEIVE> clazz,
ByteBuf... dataBodies) {
assert rpcConfig.checkSend(rpcType, protobufBody.getClass(), clazz);
connection.sendUnsafe(new ProxyListener<RECEIVE>(outcomeListener), RpcType.MESSAGE, msg(rpcType, protobufBody), FabricMessage.class, dataBodies);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:ProxyConnection.java
示例14: msg
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
private <SEND extends MessageLite> FabricMessage msg(EnumLite rpcType, SEND protobufBody){
return FabricMessage.newBuilder()
.setProtocolId(protocol.getProtocolId())
.setInnerRpcType(rpcType.getNumber())
.setMessage(protobufBody.toByteString())
.build();
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:8,代码来源:ProxyConnection.java
示例15: EndpointCreator
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
public EndpointCreator(FabricRunnerFactory factory, EnumLite num, Class<RESPONSE> responseClass, long timeout) {
super();
this.factory = factory;
this.num = num;
this.responseClass = responseClass;
this.timeout = timeout;
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:8,代码来源:EndpointCreator.java
示例16: PDFSCommand
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
protected PDFSCommand(Class<M> clazz, EnumLite rpcType, MessageLite request) {
super();
this.clazz = clazz;
this.rpcType = rpcType;
this.request = request;
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:8,代码来源:RemoteNodeFileSystem.java
示例17: calculateHashCodeForObject
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
private static int calculateHashCodeForObject(Object a) {
if (a instanceof byte[]) {
return Internal.hashCode((byte[]) a);
}
// Enums should be stored as integers internally.
if (a instanceof EnumLite) {
throw new UnsupportedOperationException();
}
return a.hashCode();
}
开发者ID:yeriomin,项目名称:play-store-api,代码行数:11,代码来源:MapFieldLite.java
示例18: hashEnumList
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
/**
* @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
* generated code.
*/
@Deprecated
protected static int hashEnumList(List<? extends EnumLite> list) {
int hash = 1;
for (EnumLite e : list) {
hash = 31 * hash + hashEnum(e);
}
return hash;
}
开发者ID:yeriomin,项目名称:play-store-api,代码行数:13,代码来源:AbstractMessage.java
示例19: handleAuthFailure
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
private static <S extends ServerConnection<S>, T extends EnumLite>
void handleAuthFailure(final S connection, final ResponseSender sender,
final Exception e, final T saslResponseType) throws RpcException {
final String remoteAddress = connection.getRemoteAddress().toString();
logger.debug("Authentication using mechanism {} with encryption context {} failed from client {} due to {}",
connection.getSaslServer().getMechanismName(), connection.getEncryptionCtxtString(), remoteAddress, e);
// inform the client that authentication failed, and no more
sender.send(new Response(saslResponseType, SASL_FAILED_MESSAGE));
// drop connection
throw new RpcException(e);
}
开发者ID:axbaretto,项目名称:drill,代码行数:15,代码来源:ServerAuthenticationHandler.java
示例20: RpcConfig
import com.google.protobuf.Internal.EnumLite; //导入依赖的package包/类
private RpcConfig(String name, Map<EnumLite, RpcMessageType<?, ?, ?>> sendMap,
Map<Integer, RpcMessageType<?, ?, ?>> receiveMap, int timeout, Executor executor) {
Preconditions.checkNotNull(executor, "Executor must be defined.");
this.name = name;
this.timeout = timeout;
this.sendMap = ImmutableMap.copyOf(sendMap);
this.receiveMap = ImmutableMap.copyOf(receiveMap);
this.executor = executor;
}
开发者ID:axbaretto,项目名称:drill,代码行数:10,代码来源:RpcConfig.java
注:本文中的com.google.protobuf.Internal.EnumLite类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论