类com.google.protobuf.DescriptorProtos.EnumValueOptions源码实例Demo

下面列出了怎么用com.google.protobuf.DescriptorProtos.EnumValueOptions的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: gson   文件: ProtoTypeAdapter.java
private Builder(EnumSerialization enumSerialization, CaseFormat fromFieldNameFormat,
    CaseFormat toFieldNameFormat) {
  this.serializedNameExtensions = new HashSet<Extension<FieldOptions, String>>();
  this.serializedEnumValueExtensions = new HashSet<Extension<EnumValueOptions, String>>();
  setEnumSerialization(enumSerialization);
  setFieldNameSerializationFormat(fromFieldNameFormat, toFieldNameFormat);
}
 
源代码2 项目: gson   文件: ProtoTypeAdapter.java
private ProtoTypeAdapter(EnumSerialization enumSerialization,
    CaseFormat protoFormat,
    CaseFormat jsonFormat,
    Set<Extension<FieldOptions, String>> serializedNameExtensions,
    Set<Extension<EnumValueOptions, String>> serializedEnumValueExtensions) {
  this.enumSerialization = enumSerialization;
  this.protoFormat = protoFormat;
  this.jsonFormat = jsonFormat;
  this.serializedNameExtensions = serializedNameExtensions;
  this.serializedEnumValueExtensions = serializedEnumValueExtensions;
}
 
源代码3 项目: gson   文件: ProtoTypeAdapter.java
/**
 * Retrieves the custom enum value name from the given options, and if not found, returns the
 * specified default value.
 */
private String getCustSerializedEnumValue(EnumValueOptions options, String defaultValue) {
  for (Extension<EnumValueOptions, String> extension : serializedEnumValueExtensions) {
    if (options.hasExtension(extension)) {
      return options.getExtension(extension);
    }
  }
  return defaultValue;
}
 
源代码4 项目: api-compiler   文件: DescriptorGenerator.java
private EnumValueOptions generateEnumValueOptions(EnumValue value) {
  EnumValueOptions.Builder builder = EnumValueOptions.newBuilder();
  setOptions(builder, value.getOptionsList(), ENUM_VALUE_OPTION_NAME_PREFIX);
  return builder.build();
}
 
源代码5 项目: play-store-api   文件: Descriptors.java
/**
 * Get the {@code EnumValueOptions}, defined in {@code descriptor.proto}.
 */
public EnumValueOptions getOptions() { return proto.getOptions(); }
 
源代码6 项目: gson   文件: ProtoTypeAdapter.java
/**
 * Adds an enum value proto annotation that, when set, overrides the default <b>enum</b> value
 * serialization/deserialization of this adapter. For example, if you add the '
 * {@code serialized_value}' annotation and you define an enum in your proto like the one below:
 *
 * <pre>
 * enum MyEnum {
 *   UNKNOWN = 0;
 *   CLIENT_APP_ID = 1 [(serialized_value) = "APP_ID"];
 *   TWO = 2 [(serialized_value) = "2"];
 * }
 * </pre>
 *
 * ...the adapter will serialize the value {@code CLIENT_APP_ID} as "{@code APP_ID}" and the
 * value {@code TWO} as "{@code 2}". This works for both serialization and deserialization.
 * <p>
 * Note that you need to set the enum serialization of this adapter to
 * {@link EnumSerialization#NAME}, otherwise these annotations will be ignored.
 */
public Builder addSerializedEnumValueExtension(
    Extension<EnumValueOptions, String> serializedEnumValueExtension) {
  serializedEnumValueExtensions.add(checkNotNull(serializedEnumValueExtension));
  return this;
}
 
 类所在包
 类方法
 同包方法