src/org/ohmage/domain/Observer.java
public void toJson(
				final JsonGenerator generator)
				throws JsonGenerationException, IOException {
			
			// Write the start of this observer's object.
			generator.writeStartObject();
			
			try {
				// Add the ID.
				generator.writeStringField(KEY_JSON_ID, id);
				
				// Add the version.
				generator.writeNumberField(KEY_JSON_VERSION, version);
				
				// Add the name.
				generator.writeStringField(KEY_JSON_NAME, name);
				
				// Add the description.
				generator.writeStringField(KEY_JSON_DESCRIPTION, description);

				// Add the "with ID" boolean if it was given..
				if(withId != null) {
					generator.writeBooleanField(KEY_JSON_WITH_ID, withId);
				}
				
				// Add the "with timestamp" boolean.
				if(withTimestamp != null) {
					generator.writeBooleanField(
						KEY_JSON_WITH_TIMESTAMP, 
						withTimestamp);
				}
				
				// Add the "with location" boolean.
				if(withLocation != null) {
					generator.writeBooleanField(
						KEY_JSON_WITH_LOCATION, 
						withLocation);
				}
				
				// Add the schema.
				generator.writeObjectField(
					KEY_JSON_SCHEMA, 
					schema.readValueAsTree());
			}
			finally {
				// Close this observer's object.
				generator.writeEndObject();
			}
		}
/**
		 * Writes this stream to the JSON generator.
		 * 
		 * @param generator The JSON generator to write the output to. This 
		 * 					should already be setup and ready to go.
		 * 
		 * @throws JsonProcessingException There was a problem with the 
		 * 								   generator that prevented data from 
		 * 								   being written.
		 * 
		 * @throws IOException There was a problem writing to the generator.
		 */
Writes this stream to the JSON generator.

@param generator The JSON generator to write the output to. This
should already be setup and ready to go.

@throws JsonProcessingException There was a problem with the
generator that prevented data from
being written.

@throws IOException There was a problem writing to the generator.
Writes this stream to the JSON generator . @param generator The JSON generator to write the output to . This should already be setup and ready to go . @throws JsonProcessingException There was a problem with the generator that prevented data from being written . @throws IOException There was a problem writing to the generator .
public void toJson(
				final JsonGenerator generator)
				throws JsonGenerationException, IOException {
			generator.writeStartObject();
			try {
				generator.writeStringField(KEY_JSON_ID, id);
				generator.writeNumberField(KEY_JSON_VERSION, version);
				generator.writeStringField(KEY_JSON_NAME, name);
				generator.writeStringField(KEY_JSON_DESCRIPTION, description);
				if(withId != null) {
					generator.writeBooleanField(KEY_JSON_WITH_ID, withId);
				}
				if(withTimestamp != null) {
					generator.writeBooleanField(
						KEY_JSON_WITH_TIMESTAMP, 
						withTimestamp);
				}
				if(withLocation != null) {
					generator.writeBooleanField(
						KEY_JSON_WITH_LOCATION, 
						withLocation);
				}
				generator.writeObjectField(
					KEY_JSON_SCHEMA, 
					schema.readValueAsTree());
			}
			finally {
				generator.writeEndObject();
			}
		}
public void toJson ( final JsonGenerator generator ) throws JsonGenerationException , IOException { generator . writeStartObject ( ) ; try { generator . writeStringField ( KEY_JSON_ID , id ) ; generator . writeNumberField ( KEY_JSON_VERSION , version ) ; generator . writeStringField ( KEY_JSON_NAME , name ) ; generator . writeStringField ( KEY_JSON_DESCRIPTION , description ) ; if ( withId != null ) { generator . writeBooleanField ( KEY_JSON_WITH_ID , withId ) ; } if ( withTimestamp != null ) { generator . writeBooleanField ( KEY_JSON_WITH_TIMESTAMP , withTimestamp ) ; } if ( withLocation != null ) { generator . writeBooleanField ( KEY_JSON_WITH_LOCATION , withLocation ) ; } generator . writeObjectField ( KEY_JSON_SCHEMA , schema . readValueAsTree ( ) ) ; } finally { generator . writeEndObject ( ) ; } }
Writes this stream to the JSON generator.
Writes this stream to the JSON generator .
// Write the start of this observer's object. // Add the ID. // Add the version. // Add the name. // Add the description. // Add the "with ID" boolean if it was given.. // Add the "with timestamp" boolean. // Add the "with location" boolean. // Add the schema. // Close this observer's object.