aboutsummaryrefslogtreecommitdiffhomepage
path: root/javanano
diff options
context:
space:
mode:
authorGravatar Jeff Davidson <jpd@google.com>2015-02-11 13:12:14 -0800
committerGravatar Brian Duff <bduff@google.com>2015-04-28 13:01:12 -0700
commitec19be2f3c7a95f3b7d6d0ff7055daead9284d8d (patch)
tree0b55f93e6392700601001f42b29e979cdcefc860 /javanano
parent41f0294cd6dc8aed2b3591d3ada9db8debd6a0d6 (diff)
Generate @IntDef annotations for nanoproto enums.
@IntDef is a support library annotation which allows build tools to determine the valid set of values for a given integer field when that field is intended to be restricted like an enum. This avoids the overhead of enums while still allowing for compile-time type checking in most circumstances. Change-Id: Iee02e0b49a8e069f6456572f538e0a0d301fdfd5
Diffstat (limited to 'javanano')
-rw-r--r--javanano/README.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/javanano/README.md b/javanano/README.md
index 7d696aa7..e19b90b1 100644
--- a/javanano/README.md
+++ b/javanano/README.md
@@ -145,6 +145,7 @@ optional_field_style -> default or accessors
enum_style -> c or java
ignore_services -> true or false
parcelable_messages -> true or false
+generate_intdefs -> true or false
```
**java_package=\<file-name\>|\<package-name\>** (no default)
@@ -302,6 +303,28 @@ parcelable_messages -> true or false
Android-specific option to generate Parcelable messages.
+**generate_intdefs={true,false}** (default: false)
+ Android-specific option to generate @IntDef annotations for enums.
+
+ If turned on, an '@IntDef' annotation (a public @interface) will be
+ generated for each enum, and every integer parameter and return
+ value in the generated code meant for this enum will be annotated
+ with it. This interface is generated with the same name and at the
+ same place as the enum members' container interfaces described
+ above under 'enum_style=java', regardless of the enum_style option
+ used. When this is combined with enum_style=java, the interface
+ will be both the '@IntDef' annotation and the container of the enum
+ members; otherwise the interface has an empty body.
+
+ Your app must declare a compile-time dependency on the
+ android-support-annotations library.
+
+ For more information on how these @IntDef annotations help with
+ compile-time type safety, see:
+ https://sites.google.com/a/android.com/tools/tech-docs/support-annotations
+ and
+ https://developer.android.com/reference/android/support/annotation/IntDef.html
+
To use nano protobufs within the Android repo:
----------------------------------------------