本文整理汇总了Java中com.google.protobuf.Internal类的典型用法代码示例。如果您正苦于以下问题:Java Internal类的具体用法?Java Internal怎么用?Java Internal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Internal类属于com.google.protobuf包,在下文中一共展示了Internal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: unpack
import com.google.protobuf.Internal; //导入依赖的package包/类
public static <T extends Message> T unpack(AxAnyProto.AxAny any, Class<T> message) throws InvalidProtocolBufferException {
T var1 = Internal.getDefaultInstance(message);
if (!is(any, var1)) {
throw new InvalidProtocolBufferException("Type of the Any message does not match the given class.");
}
T result = (T) var1.getParserForType()
.parseFrom(any.getValue());
return result;
}
开发者ID:ogcs,项目名称:Okra-Ax,代码行数:10,代码来源:AxAnyUtil.java
示例2: ReferenceValidator
import com.google.protobuf.Internal; //导入依赖的package包/类
ReferenceValidator(Enricher enricher,
Class<? extends Message> eventClass,
Class<? extends Message> enrichmentClass) {
this.enricher = enricher;
this.eventDescriptor = Internal.getDefaultInstance(eventClass)
.getDescriptorForType();
this.enrichmentDescriptor = Internal.getDefaultInstance(enrichmentClass)
.getDescriptorForType();
}
开发者ID:SpineEventEngine,项目名称:core-java,代码行数:10,代码来源:ReferenceValidator.java
示例3: apply
import com.google.protobuf.Internal; //导入依赖的package包/类
@Override
public T apply(S eventMsg, C context) {
checkNotNull(eventMsg);
checkNotNull(context);
ensureActive();
verifyOwnState();
final T defaultTarget = Internal.getDefaultInstance(getEnrichmentClass());
final Message.Builder builder = defaultTarget.toBuilder();
setFields(builder, eventMsg, context);
@SuppressWarnings("unchecked") // types are checked during the initialization and validation
final T result = (T) builder.build();
return result;
}
开发者ID:SpineEventEngine,项目名称:core-java,代码行数:15,代码来源:MessageEnrichment.java
示例4: calculateHashCodeForObject
import com.google.protobuf.Internal; //导入依赖的package包/类
/**
* Calculate hash code for object.
*
* @param a the a
* @return the int
*/
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:jhunters,项目名称:jprotobuf,代码行数:17,代码来源:MapFieldLite.java
示例5: fromFieldNumbers
import com.google.protobuf.Internal; //导入依赖的package包/类
/**
* Constructs a FieldMask from the passed field numbers.
*
* @throws IllegalArgumentException if any of the fields are invalid for the message.
*/
public static FieldMask fromFieldNumbers(
Class<? extends Message> type, Iterable<Integer> fieldNumbers) {
Descriptor descriptor = Internal.getDefaultInstance(type).getDescriptorForType();
FieldMask.Builder builder = FieldMask.newBuilder();
for (Integer fieldNumber : fieldNumbers) {
FieldDescriptor field = descriptor.findFieldByNumber(fieldNumber);
checkArgument(
field != null,
String.format("%s is not a valid field number for %s.", fieldNumber, type));
builder.addPaths(field.getName());
}
return builder.build();
}
开发者ID:bazelbuild,项目名称:bazel,代码行数:20,代码来源:FieldMaskUtil.java
示例6: match
import com.google.protobuf.Internal; //导入依赖的package包/类
@Override
public boolean match(Internal.EnumLite forward, Internal.EnumLite opcode) {
return DOMAIN.MATCHING_VALUE == forward.getNumber() && REQUEST_OPCODE.JOIN_MATCH_QUENE.equals(opcode);
}
开发者ID:freedompy,项目名称:commelina,代码行数:5,代码来源:MatchingJoinMatch.java
示例7: match
import com.google.protobuf.Internal; //导入依赖的package包/类
@Override
public boolean match(Internal.EnumLite forward, Internal.EnumLite opcode) {
return forward.getNumber() == DOMAIN.MATCHING_VALUE
&& NOTIFY_OPCODE.NOTIFY_MATCH_SUCCESS.getNumber() == opcode.getNumber();
}
开发者ID:freedompy,项目名称:commelina,代码行数:6,代码来源:MatchingWaitForMatchStatus.java
示例8: match
import com.google.protobuf.Internal; //导入依赖的package包/类
@Override
public boolean match(Internal.EnumLite forward, Internal.EnumLite opcode) {
return forward.getNumber() == DOMAIN.MATCHING_VALUE && opcode.getNumber() == REQUEST_OPCODE.JOIN_MATCH_QUENE_VALUE;
}
开发者ID:freedompy,项目名称:commelina,代码行数:5,代码来源:MatchingWaitForJoinRoom.java
示例9: error
import com.google.protobuf.Internal; //导入依赖的package包/类
public static ResponseBodyMessage<String> error(Internal.EnumLite code) {
Preconditions.checkArgument(code.getNumber() > 0);
return success(code, null);
}
开发者ID:freedompy,项目名称:commelina,代码行数:5,代码来源:ResponseBodyMessage.java
示例10: success
import com.google.protobuf.Internal; //导入依赖的package包/类
public static <T extends Serializable> ResponseBodyMessage<T> success(Internal.EnumLite code, T data) {
return new ResponseBodyMessage<>(code.getNumber(), data);
}
开发者ID:freedompy,项目名称:commelina,代码行数:4,代码来源:ResponseBodyMessage.java
示例11: error
import com.google.protobuf.Internal; //导入依赖的package包/类
public static ResponseBodyEntity<String> error(Internal.EnumLite code) {
return success(code, null);
}
开发者ID:freedompy,项目名称:commelina,代码行数:4,代码来源:ResponseBodyEntity.java
示例12: success
import com.google.protobuf.Internal; //导入依赖的package包/类
public static <T> ResponseBodyEntity<T> success(Internal.EnumLite code, T data) {
return new ResponseBodyEntity<>(code.getNumber(), data);
}
开发者ID:freedompy,项目名称:commelina,代码行数:4,代码来源:ResponseBodyEntity.java
示例13: ServiceEmptyMessage
import com.google.protobuf.Internal; //导入依赖的package包/类
private ServiceEmptyMessage(Internal.EnumLite errorCode) {
this.errorCode = errorCode;
}
开发者ID:freedompy,项目名称:commelina,代码行数:4,代码来源:ServiceEmptyMessage.java
示例14: newMessage
import com.google.protobuf.Internal; //导入依赖的package包/类
public static ServiceEmptyMessage newMessage(Internal.EnumLite errorCode) {
return newMessage(errorCode);
}
开发者ID:freedompy,项目名称:commelina,代码行数:4,代码来源:ServiceEmptyMessage.java
示例15: getErrorCode
import com.google.protobuf.Internal; //导入依赖的package包/类
public Internal.EnumLite getErrorCode() {
return errorCode;
}
开发者ID:freedompy,项目名称:commelina,代码行数:4,代码来源:ServiceEmptyMessage.java
示例16: ServiceMessage
import com.google.protobuf.Internal; //导入依赖的package包/类
private ServiceMessage(Internal.EnumLite errorCode, T data) {
this.errorCode = errorCode;
this.data = data;
}
开发者ID:freedompy,项目名称:commelina,代码行数:5,代码来源:ServiceMessage.java
示例17: newMessage
import com.google.protobuf.Internal; //导入依赖的package包/类
public static <T> ServiceMessage<T> newMessage(Internal.EnumLite errorCode, T t) {
return new ServiceMessage<>(errorCode, t);
}
开发者ID:freedompy,项目名称:commelina,代码行数:4,代码来源:ServiceMessage.java
示例18: is
import com.google.protobuf.Internal; //导入依赖的package包/类
public static <T extends Message> boolean is(AxAnyProto.AxAny any, Class<T> clazz) {
return is(any, Internal.getDefaultInstance(clazz));
}
开发者ID:ogcs,项目名称:Okra-Ax,代码行数:4,代码来源:AxAnyUtil.java
示例19: internalGetValueMap
import com.google.protobuf.Internal; //导入依赖的package包/类
public static Internal.EnumLiteMap<Type> internalGetValueMap() {
return internalValueMap;
}
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:4,代码来源:PushSMPMessageProtos.java
示例20: computeElementSizeNoTag
import com.google.protobuf.Internal; //导入依赖的package包/类
/**
* Compute the number of bytes that would be needed to encode a particular value of arbitrary type, excluding tag.
*
* @param type The field's type.
* @param value Object representing the field's value. Must be of the exact type which would be returned by
* {@link Message#getField(Descriptors.FieldDescriptor)} for this field.
* @return the int
*/
public static int computeElementSizeNoTag(final WireFormat.FieldType type, final Object value) {
switch (type) {
// Note: Minor violation of 80-char limit rule here because this would
// actually be harder to read if we wrapped the lines.
case DOUBLE:
return CodedOutputStream.computeDoubleSizeNoTag((Double) value);
case FLOAT:
return CodedOutputStream.computeFloatSizeNoTag((Float) value);
case INT64:
return CodedOutputStream.computeInt64SizeNoTag((Long) value);
case UINT64:
return CodedOutputStream.computeUInt64SizeNoTag((Long) value);
case INT32:
return CodedOutputStream.computeInt32SizeNoTag((Integer) value);
case FIXED64:
return CodedOutputStream.computeFixed64SizeNoTag((Long) value);
case FIXED32:
return CodedOutputStream.computeFixed32SizeNoTag((Integer) value);
case BOOL:
return CodedOutputStream.computeBoolSizeNoTag((Boolean) value);
case STRING:
return CodedOutputStream.computeStringSizeNoTag((String) value);
case GROUP:
return CodedOutputStream.computeGroupSizeNoTag((MessageLite) value);
case BYTES:
if (value instanceof ByteString) {
return CodedOutputStream.computeBytesSizeNoTag((ByteString) value);
} else {
return CodedOutputStream.computeByteArraySizeNoTag((byte[]) value);
}
case UINT32:
return CodedOutputStream.computeUInt32SizeNoTag((Integer) value);
case SFIXED32:
return CodedOutputStream.computeSFixed32SizeNoTag((Integer) value);
case SFIXED64:
return CodedOutputStream.computeSFixed64SizeNoTag((Long) value);
case SINT32:
return CodedOutputStream.computeSInt32SizeNoTag((Integer) value);
case SINT64:
return CodedOutputStream.computeSInt64SizeNoTag((Long) value);
case MESSAGE:
if (value instanceof LazyField) {
return CodedOutputStream.computeLazyFieldSizeNoTag((LazyField) value);
} else {
return computeObjectSizeNoTag(value);
}
case ENUM:
if (value instanceof Internal.EnumLite) {
return CodedOutputStream.computeEnumSizeNoTag(((Internal.EnumLite) value).getNumber());
} else {
if (value instanceof EnumReadable) {
return CodedOutputStream.computeEnumSizeNoTag(((EnumReadable) value).value());
} else if (value instanceof Enum) {
return CodedOutputStream.computeEnumSizeNoTag(((Enum) value).ordinal());
}
return CodedOutputStream.computeEnumSizeNoTag((Integer) value);
}
}
throw new RuntimeException("There is no way to get here, but the compiler thinks otherwise.");
}
开发者ID:jhunters,项目名称:jprotobuf,代码行数:73,代码来源:CodedConstant.java
注:本文中的com.google.protobuf.Internal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论