summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBehrooz Khorashadi <behrooz@google.com>2014-10-29 16:40:09 -0700
committerBehrooz Khorashadi <behrooz@google.com>2014-11-05 11:15:07 -0800
commitb804c689e40caa1d3b77cd24ec4453dc9060d222 (patch)
tree1b1a7d8f9458a41672b9ea3defcec3ce20a6dbc3
parent1ed1ec3609812a7818689cde01b6ce92d3f2315a (diff)
downloadexternal_protobuf-b804c689e40caa1d3b77cd24ec4453dc9060d222.zip
external_protobuf-b804c689e40caa1d3b77cd24ec4453dc9060d222.tar.gz
external_protobuf-b804c689e40caa1d3b77cd24ec4453dc9060d222.tar.bz2
Added an API method in FieldData to allow access to the UnknownField data
Change-Id: I2cd5cfc80dce2a297fcd2511074b2a9d23d39837
-rw-r--r--java/src/main/java/com/google/protobuf/nano/FieldData.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/java/src/main/java/com/google/protobuf/nano/FieldData.java b/java/src/main/java/com/google/protobuf/nano/FieldData.java
index 7a5eb4c..e5b69aa 100644
--- a/java/src/main/java/com/google/protobuf/nano/FieldData.java
+++ b/java/src/main/java/com/google/protobuf/nano/FieldData.java
@@ -58,6 +58,23 @@ class FieldData {
unknownFieldData.add(unknownField);
}
+ UnknownFieldData getUnknownField(int index) {
+ if (unknownFieldData == null) {
+ return null;
+ }
+ if (index < unknownFieldData.size()) {
+ return unknownFieldData.get(index);
+ }
+ return null;
+ }
+
+ int getUnknownFieldSize() {
+ if (unknownFieldData == null) {
+ return 0;
+ }
+ return unknownFieldData.size();
+ }
+
<T> T getValue(Extension<?, T> extension) {
if (value != null){
if (cachedExtension != extension) { // Extension objects are singletons.