src/org/ohmage/domain/Observer.java
public void toJson(
			final JsonGenerator generator)
			throws JsonProcessingException, 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 version string.
			generator.writeStringField(KEY_JSON_VERSION_STRING, versionString);
			
			// Add the observer's streams.
			generator.writeArrayFieldStart(KEY_JSON_STREAMS);
			try {
				for(Stream stream : streams.values()) {
					stream.toJson(generator);
				}
			}
			finally {
				generator.writeEndArray();
			}
		}
		finally {
			// Close this observer's object.
			generator.writeEndObject();
		}
	}
/**
	 * Writes this observer 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 observer 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 observer 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 JsonProcessingException, 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);
			generator.writeStringField(KEY_JSON_VERSION_STRING, versionString);
			generator.writeArrayFieldStart(KEY_JSON_STREAMS);
			try {
				for(Stream stream : streams.values()) {
					stream.toJson(generator);
				}
			}
			finally {
				generator.writeEndArray();
			}
		}
		finally {
			generator.writeEndObject();
		}
	}
public void toJson ( final JsonGenerator generator ) throws JsonProcessingException , 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 ) ; generator . writeStringField ( KEY_JSON_VERSION_STRING , versionString ) ; generator . writeArrayFieldStart ( KEY_JSON_STREAMS ) ; try { for ( Stream stream : streams . values ( ) ) { stream . toJson ( generator ) ; } } finally { generator . writeEndArray ( ) ; } } finally { generator . writeEndObject ( ) ; } }
Writes this observer to the JSON generator.
Writes this observer 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 version string. // Add the observer's streams. // Close this observer's object.