~ubuntu-branches/ubuntu/precise/protobuf/precise

« back to all changes in this revision

Viewing changes to src/google/protobuf/compiler/java/java_string_field.cc

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2011-12-01 16:08:20 UTC
  • mfrom: (2.2.9 sid)
  • Revision ID: package-import@ubuntu.com-20111201160820-fcsdfvulz5seu6ij
Tags: 2.4.1-1ubuntu1
* Merge from Debian testing.  Remaining changes:
  - Switch to dh_python2
  - Fix linking with -lpthread

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
void StringFieldGenerator::
169
169
GenerateMembers(io::Printer* printer) const {
170
170
  printer->Print(variables_,
171
 
    "private Object $name$_;\n"
 
171
    "private java.lang.Object $name$_;\n"
172
172
    "$deprecation$public boolean has$capitalized_name$() {\n"
173
173
    "  return $get_has_field_bit_message$;\n"
174
174
    "}\n");
175
175
 
176
176
  printer->Print(variables_,
177
177
    "$deprecation$public String get$capitalized_name$() {\n"
178
 
    "  Object ref = $name$_;\n"
 
178
    "  java.lang.Object ref = $name$_;\n"
179
179
    "  if (ref instanceof String) {\n"
180
180
    "    return (String) ref;\n"
181
181
    "  } else {\n"
189
189
    "  }\n"
190
190
    "}\n"
191
191
    "private com.google.protobuf.ByteString get$capitalized_name$Bytes() {\n"
192
 
    "  Object ref = $name$_;\n"
 
192
    "  java.lang.Object ref = $name$_;\n"
193
193
    "  if (ref instanceof String) {\n"
194
194
    "    com.google.protobuf.ByteString b = \n"
195
195
    "        com.google.protobuf.ByteString.copyFromUtf8((String) ref);\n"
204
204
void StringFieldGenerator::
205
205
GenerateBuilderMembers(io::Printer* printer) const {
206
206
  printer->Print(variables_,
207
 
    "private Object $name$_ $default_init$;\n"
 
207
    "private java.lang.Object $name$_ $default_init$;\n"
208
208
    "$deprecation$public boolean has$capitalized_name$() {\n"
209
209
    "  return $get_has_field_bit_builder$;\n"
210
210
    "}\n");
211
211
 
212
212
  printer->Print(variables_,
213
213
    "$deprecation$public String get$capitalized_name$() {\n"
214
 
    "  Object ref = $name$_;\n"
 
214
    "  java.lang.Object ref = $name$_;\n"
215
215
    "  if (!(ref instanceof String)) {\n"
216
216
    "    String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();\n"
217
217
    "    $name$_ = s;\n"