Examples of WriteFieldsTemplatedFile


Examples of rocket.json.rebind.writefields.WriteFieldsTemplatedFile

    jsonObjectParameter.setFinal(true);
    jsonObjectParameter.setName(Constants.WRITE_FIELD_JSON_OBJECT_PARAMETER);
    final Type jsonObjectType = this.getJsonObject();
    jsonObjectParameter.setType(jsonObjectType);

    final WriteFieldsTemplatedFile body = new WriteFieldsTemplatedFile();
    body.setInstanceType(type);
    writeFields.setBody(body);

    // find all fields belonging to type
    final Iterator fields = type.getFields().iterator();
    while (fields.hasNext()) {
      final Field field = (Field) fields.next();
      if (field.isStatic() || field.isTransient()) {
        continue;
      }

      final NewMethod fieldGetter = this.createFieldGetter(deserializer, field);
      final String javascriptPropertyName = this.getJavascriptPropertyName(field);
      final Type serializer = this.getSerializer(field);

      body.addField(javascriptPropertyName, fieldGetter, serializer);
    } // while

    context.unbranch();
  }
View Full Code Here

Examples of rocket.serialization.rebind.write.WriteFieldsTemplatedFile

    final NewMethodParameter objectOutputStream = newMethod.newParameter();
    objectOutputStream.setFinal(true);
    objectOutputStream.setName(SerializationConstants.CLIENT_OBJECT_WRITER_IMPL_WRITE_FIELDS_OBJECT_OUTPUT_STREAM_PARAMETER);
    objectOutputStream.setType(this.getObjectOutputStream());

    final WriteFieldsTemplatedFile body = new WriteFieldsTemplatedFile();
    body.setType(type);
    newMethod.setBody(body);

    // add all fields to the template
    final Iterator fields = this.filterSerializableFields(type.getFields()).iterator();
    int fieldCount = 0;

    context.branch();

    while (fields.hasNext()) {
      final Field field = (Field) fields.next();
      final Method getter = this.createFieldGetter(writer, field);
      body.addFieldGetter(getter);

      fieldCount++;
    }

    context.unbranch();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.