Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.factual.driver;
 
 import java.util.Map;

Represents metadata to be sent with submit and flag requests

Author(s):
brandon
 
 public class Metadata {
	private static final String USER = "user";
	private static final String DEBUG = "debug";
	private static final String COMMENT = "comment";
	private static final String REFERENCE = "reference";
	private Parameters queryParams = new Parameters();

Constructor. Create metadata to associate with submit and flag requests
	public Metadata() {
	}
	private Metadata(Parameters queryParams) {
		this. = queryParams;
	}

Set a user name for the person submitting the data

Parameters:
username
Returns:
new Metadata, with a username set
	public Metadata user(String username) {
		Parameters params = .copy();
		params.setParam(username);
		return new Metadata(params);
	}

The request will only be a test query and no actual data will be written

Returns:
new Metadata, marked as a debug request
	private Metadata debug() {
		return debug(true);
	}

When true, the request will only be a test query and no actual data will be written. The default behavior is to NOT include debug.

Parameters:
debug true if you want this to be a test query where no actual date is written
Returns:
new Metadata, marked with whether or not this is a debug request
	private Metadata debug(boolean debug) {
		Parameters params = .copy();
		params.setParam(debug);
		return new Metadata(params);
	}

Set a comment that will help to explain your corrections

Parameters:
comment the comment that may help explain your corrections
Returns:
new Metadata, with a comment set
	public Metadata comment(String comment) {
		Parameters params = .copy();
		params.setParam(comment);
		return new Metadata(params);
	}

Set a reference to a URL, title, person, etc. that is the source of this data

Parameters:
reference a reference to a URL, title, person, etc. that is the source of this data
Returns:
new Metadata, with a reference set
	public Metadata reference(String reference) {
		Parameters params = .copy();
		params.setParam(reference);
		return new Metadata(params);
	}
	protected String toUrlQuery() {
		return .toUrlQuery(true);
	}
	protected Map<StringStringtoParamMap() {
	}
New to GrepCode? Check out our FAQ X