本文整理汇总了Java中com.google.protobuf.DescriptorProtos.FieldDescriptorProto.hasExtendee方法的典型用法代码示例。如果您正苦于以下问题:Java FieldDescriptorProto.hasExtendee方法的具体用法?Java FieldDescriptorProto.hasExtendee怎么用?Java FieldDescriptorProto.hasExtendee使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.protobuf.DescriptorProtos.FieldDescriptorProto
的用法示例。
在下文中一共展示了FieldDescriptorProto.hasExtendee方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FieldDescriptor
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; //导入方法依赖的package包/类
private FieldDescriptor(final FieldDescriptorProto proto,
final FileDescriptor file,
final Descriptor parent,
final int index,
final boolean isExtension)
throws DescriptorValidationException {
this.index = index;
this.proto = proto;
fullName = computeFullName(file, parent, proto.getName());
this.file = file;
if (proto.hasJsonName()) {
jsonName = proto.getJsonName();
} else {
jsonName = fieldNameToLowerCamelCase(proto.getName());
}
if (proto.hasType()) {
type = Type.valueOf(proto.getType());
}
if (getNumber() <= 0) {
throw new DescriptorValidationException(this,
"Field numbers must be positive integers.");
}
if (isExtension) {
if (!proto.hasExtendee()) {
throw new DescriptorValidationException(this,
"FieldDescriptorProto.extendee not set for extension field.");
}
containingType = null; // Will be filled in when cross-linking
if (parent != null) {
extensionScope = parent;
} else {
extensionScope = null;
}
if (proto.hasOneofIndex()) {
throw new DescriptorValidationException(this,
"FieldDescriptorProto.oneof_index set for extension field.");
}
containingOneof = null;
} else {
if (proto.hasExtendee()) {
throw new DescriptorValidationException(this,
"FieldDescriptorProto.extendee set for non-extension field.");
}
containingType = parent;
if (proto.hasOneofIndex()) {
if (proto.getOneofIndex() < 0 ||
proto.getOneofIndex() >= parent.toProto().getOneofDeclCount()) {
throw new DescriptorValidationException(this,
"FieldDescriptorProto.oneof_index is out of range for type "
+ parent.getName());
}
containingOneof = parent.getOneofs().get(proto.getOneofIndex());
containingOneof.fieldCount++;
} else {
containingOneof = null;
}
extensionScope = null;
}
file.pool.addSymbol(this);
}
示例2: FieldDescriptor
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; //导入方法依赖的package包/类
private FieldDescriptor (final FieldDescriptorProto proto,
final FileDescriptor file,
final Descriptor parent,
final int index,
final boolean isExtension)
throws DescriptorValidationException {
this.index = index;
this.proto = proto;
fullName = computeFullName (file, parent, proto.getName ());
this.file = file;
if (proto.hasType ()) {
type = Type.valueOf (proto.getType ());
}
if (getNumber () <= 0) {
throw new DescriptorValidationException (this,
"Field numbers must be positive integers.");
}
// Only repeated primitive fields may be packed.
if (proto.getOptions ().getPacked () && !isPackable ()) {
throw new DescriptorValidationException (this,
"[packed = true] can only be specified for repeated primitive "
+ "fields.");
}
if (isExtension) {
if (!proto.hasExtendee ()) {
throw new DescriptorValidationException (this,
"FieldDescriptorProto.extendee not set for extension field.");
}
containingType = null; // Will be filled in when cross-linking
if (parent != null) {
extensionScope = parent;
} else {
extensionScope = null;
}
if (proto.hasOneofIndex ()) {
throw new DescriptorValidationException (this,
"FieldDescriptorProto.oneof_index set for extension field.");
}
containingOneof = null;
} else {
if (proto.hasExtendee ()) {
throw new DescriptorValidationException (this,
"FieldDescriptorProto.extendee set for non-extension field.");
}
containingType = parent;
if (proto.hasOneofIndex ()) {
if (proto.getOneofIndex () < 0
|| proto.getOneofIndex () >= parent.toProto ().getOneofDeclCount ()) {
throw new DescriptorValidationException (this,
"FieldDescriptorProto.oneof_index is out of range for type "
+ parent.getName ());
}
containingOneof = parent.getOneofs ().get (proto.getOneofIndex ());
containingOneof.fieldCount++;
} else {
containingOneof = null;
}
extensionScope = null;
}
file.pool.addSymbol (this);
}
示例3: isFieldCanonical
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; //导入方法依赖的package包/类
private boolean isFieldCanonical(final FieldDescriptorProto field) {
return (!field.hasExtendee() || field.getExtendee().startsWith("."))
&& (!field.hasTypeName() || field.getTypeName().startsWith(".") && field.hasType())
&& !(field.hasOptions() && field.getOptions().getUninterpretedOptionCount() > 0);
}