本文整理汇总了Java中com.google.protobuf.DescriptorProtos.FieldDescriptorProto.getOptions方法的典型用法代码示例。如果您正苦于以下问题:Java FieldDescriptorProto.getOptions方法的具体用法?Java FieldDescriptorProto.getOptions怎么用?Java FieldDescriptorProto.getOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.protobuf.DescriptorProtos.FieldDescriptorProto
的用法示例。
在下文中一共展示了FieldDescriptorProto.getOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addColumn
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; //导入方法依赖的package包/类
protected void addColumn(Column column) {
String fieldName = uniqueIdent(ident(column.getName(), false), fieldNames);
fieldBuilder = messageBuilder.addFieldBuilder();
fieldBuilder.setName(fieldName);
fieldBuilder.setLabel(Label.LABEL_OPTIONAL);
FieldOptions.Builder fieldBuilderOptions = FieldOptions.newBuilder();
ColumnOptions.Builder columnOptions = ColumnOptions.newBuilder();
if (!fieldName.equals(column.getName())) {
columnOptions.setName(column.getName());
}
columnOptions.setSqlType(column.getTypeDescription().toUpperCase());
columnOptions.setUuid(column.getUuid().toString());
priorField = null;
if (priorMessage != null) {
for (FieldDescriptorProto field : priorMessage.getFieldList()) {
FieldOptions options = field.getOptions();
if ((options != null) &&
(options.hasExtension(ColumnOptions.fdbsql))) {
ColumnOptions coptions = options.getExtension(ColumnOptions.fdbsql);
if (coptions.getUuid().equals(columnOptions.getUuid())) {
priorField = field;
break;
}
}
}
}
setColumnType(column, columnOptions);
setFieldNumber();
fieldBuilderOptions.setExtension(ColumnOptions.fdbsql, columnOptions.build());
fieldBuilder.setOptions(fieldBuilderOptions);
if (column.getNullable() &&
((column.getDefaultValue() != null) ||
(column.getDefaultFunction() != null))) {
addNullForField(column.getName(), fieldBuilder.getNumber());
}
}
示例2: addNullForField
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; //导入方法依赖的package包/类
protected void addNullForField(String columnName, int forField) {
String fieldName = uniqueIdent("_" + ident(columnName, false) + "_is_null", fieldNames);
fieldBuilder = messageBuilder.addFieldBuilder();
fieldBuilder.setName(fieldName);
fieldBuilder.setType(Type.TYPE_BOOL);
fieldBuilder.setLabel(Label.LABEL_OPTIONAL);
FieldOptions.Builder fieldBuilderOptions = FieldOptions.newBuilder();
ColumnOptions.Builder columnOptions = ColumnOptions.newBuilder();
columnOptions.setNullForField(forField);
priorField = null;
if (priorMessage != null) {
for (FieldDescriptorProto field : priorMessage.getFieldList()) {
FieldOptions options = field.getOptions();
if ((options != null) &&
(options.hasExtension(ColumnOptions.fdbsql))) {
ColumnOptions coptions = options.getExtension(ColumnOptions.fdbsql);
if (coptions.hasNullForField() &&
(coptions.getNullForField() == forField)) {
priorField = field;
break;
}
}
}
}
setFieldNumber();
fieldBuilderOptions.setExtension(ColumnOptions.fdbsql, columnOptions.build());
fieldBuilder.setOptions(fieldBuilderOptions);
}
示例3: addChildTable
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; //导入方法依赖的package包/类
protected void addChildTable(Table table) {
String fieldName = uniqueIdent(ident(table.getName().getTableName(), false), fieldNames);
fieldBuilder = messageBuilder.addFieldBuilder();
fieldBuilder.setName(fieldName);
fieldBuilder.setLabel(Label.LABEL_REPEATED);
fieldBuilder.setType(Type.TYPE_MESSAGE);
fieldBuilder.setTypeName(tableMessageNames.get(table));
FieldOptions.Builder fieldBuilderOptions = FieldOptions.newBuilder();
ColumnOptions.Builder columnOptions = ColumnOptions.newBuilder();
columnOptions.setUuid(table.getUuid().toString());
priorField = null;
if (priorMessage != null) {
for (FieldDescriptorProto field : priorMessage.getFieldList()) {
FieldOptions options = field.getOptions();
if ((options != null) &&
(options.hasExtension(ColumnOptions.fdbsql))) {
ColumnOptions coptions = options.getExtension(ColumnOptions.fdbsql);
if (coptions.getUuid().equals(columnOptions.getUuid())) {
priorField = field;
break;
}
}
}
}
setFieldNumber();
fieldBuilderOptions.setExtension(ColumnOptions.fdbsql, columnOptions.build());
fieldBuilder.setOptions(fieldBuilderOptions);
}