square/wire — pull request #131 by danrice-square (2014-04-25 16:09:32+00:00)
Title: Support options on enum values

@JakeWharton @swankjesse

This adds support for options on enum values (not the enum types themselves):

```
enum FooBarBazEnum {
FOO = 1 [enum_value_option_1=17];
BAR = 2 enum_value_option_2=true];
BAZ = 3 [enum_value_option_1=18, enum_value_option_2=false];
}

extend google.protobuf.EnumValueOptions {
optional int32 enum_value_option_1 = 70000;
optional int32 enum_value_option_2 = 70001;
}
```

resulting in:

```
public enum FooBarBazEnum
implements ProtoEnum {
FOO(1, 17, null),
BAR(2, null, true),
BAZ(3, 18, false);

private final int value;
public final Integer enum_value_option_1;
public final Boolean foreign_enum_value_option_2;

private FooBarBazEnum(int value, Integer enum_value_option_1, Boolean foreign_enum_value_option_2) {
this.value = value;
this.enum_value_option_1 = enum_value_option_1;
this.foreign_enum_value_option_2 = foreign_enum_value_option_2;
}

@Override
public int getValue() {
return value;
}
}
```

At the moment, options are all or nothing (via the `--no_options` flag). It would be good to add finer control, in particular to be enable to enable specific types of options and even specific whitelisted options within a type.