本文整理汇总了Java中com.google.protobuf.Internal类的典型用法代码示例。如果您正苦于以下问题:Java Internal类的具体用法?Java Internal怎么用?Java Internal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Internal类属于com.google.protobuf包,在下文中一共展示了Internal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例11: error
import com.google.protobuf.Internal; //导入依赖的package包/类
public static ResponseBodyEntity<String> error(Internal.EnumLite code) {
return success(code, null);
}
示例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);
}
示例13: ServiceEmptyMessage
import com.google.protobuf.Internal; //导入依赖的package包/类
private ServiceEmptyMessage(Internal.EnumLite errorCode) {
this.errorCode = errorCode;
}
示例14: newMessage
import com.google.protobuf.Internal; //导入依赖的package包/类
public static ServiceEmptyMessage newMessage(Internal.EnumLite errorCode) {
return newMessage(errorCode);
}
示例15: getErrorCode
import com.google.protobuf.Internal; //导入依赖的package包/类
public Internal.EnumLite getErrorCode() {
return errorCode;
}