OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2013 Google Inc. All rights reserved. | 2 // Copyright 2013 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // non-proto-field name collisions (hashCode() and getSerialized
Size()) | 149 // non-proto-field name collisions (hashCode() and getSerialized
Size()) |
150 if (name.startsWith("set")) { | 150 if (name.startsWith("set")) { |
151 String subfieldName = name.substring(3); | 151 String subfieldName = name.substring(3); |
152 | 152 |
153 Method hazzer = null; | 153 Method hazzer = null; |
154 try { | 154 try { |
155 hazzer = clazz.getMethod("has" + subfieldName); | 155 hazzer = clazz.getMethod("has" + subfieldName); |
156 } catch (NoSuchMethodException e) { | 156 } catch (NoSuchMethodException e) { |
157 continue; | 157 continue; |
158 } | 158 } |
159 // If hazzer doesn't exist or returns false, no need to cont
inue | 159 // If hazzer does't exist or returns false, no need to conti
nue |
160 if (!(Boolean) hazzer.invoke(object)) { | 160 if (!(Boolean) hazzer.invoke(object)) { |
161 continue; | 161 continue; |
162 } | 162 } |
163 | 163 |
164 Method getter = null; | 164 Method getter = null; |
165 try { | 165 try { |
166 getter = clazz.getMethod("get" + subfieldName); | 166 getter = clazz.getMethod("get" + subfieldName); |
167 } catch (NoSuchMethodException e) { | 167 } catch (NoSuchMethodException e) { |
168 continue; | 168 continue; |
169 } | 169 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 builder.append('\\').append((char) ch); | 266 builder.append('\\').append((char) ch); |
267 } else if (ch >= 32 && ch < 127) { | 267 } else if (ch >= 32 && ch < 127) { |
268 builder.append((char) ch); | 268 builder.append((char) ch); |
269 } else { | 269 } else { |
270 builder.append(String.format("\\%03o", ch)); | 270 builder.append(String.format("\\%03o", ch)); |
271 } | 271 } |
272 } | 272 } |
273 builder.append('"'); | 273 builder.append('"'); |
274 } | 274 } |
275 } | 275 } |
OLD | NEW |