// call this to load/reload the file new Params(); // then just read int vertices = Params.VERTICES;
@XmlRootElement public class Config { private Params params = new Params(); public Params getParams() { return params; } public void setParams(Params params) { this.params = params; } }
Foo foo = db.find(Foo.class, "doc-id", new Params().attachments()); String attachmentData = foo.getAttachments().get("attachment.txt").getData();
public class MyActualJob extends BaseJob { public static final int PRIORITY = 1; public MyActualJob() { super(new Params(PRIORITY).requireNetwork().persist()); } @Override public void onAdded() { // job added to queue } @Override public void onRun() throws Throwable { // do the work // service will be injected into BaseJob, so you can use it here final Call<User> call = service.getUser(); call.execute(); } @Override protected void onCancel() { // clean up } }
@RequestMapping(value="/HelloWorld/Summary", method = RequestMethod.GET) public ModelAndView visitSummary() { return new ModelAndView("Summary","command",new Params()); }
public class PostTweetJob extends Job { public static final int PRIORITY = 1; private String text; public PostTweetJob(String text) { // This job requires network connectivity, // and should be persisted in case the application exits before job is completed. super(new Params(PRIORITY).requireNetwork().persist()); } @Override public void onAdded() { // Job has been saved to disk. // This is a good place to dispatch a UI event to indicate the job will eventually run. // In this example, it would be good to update the UI with the newly posted tweet. } @Override public void onRun() throws Throwable { // Job logic goes here. In this example, the network call to post to Twitter is done here. webservice.postTweet(text); } @Override protected boolean shouldReRunOnThrowable(Throwable throwable) { // An error occurred in onRun. // Return value determines whether this job should retry running (true) or abort (false). } @Override protected void onCancel() { // Job has exceeded retry attempts or shouldReRunOnThrowable() has returned false. } }
return new ModelAndView("summary","command",new Params());
Params params=new Params("dev_2454","4546845446"); LoginInfo loginInfo=new LoginInfo(params,"login","123123123"); Gson gson= new GsonBuilder().setPrettyPrinting().create(); String JSON= gson.toJson(loginInfo,loginInfo.getClass()); System.out.println(JSON);
public void addParam(String field, String value) { if (params == null) params = new Params(); params.addParam(field, value); }
/** * Adds a custom parameter to the request * * @param field * Field * @param value * Value */ public void addParam(String field, String value) { if (this.params == null) this.params = new Params(); this.params.addParam(field, value); }
/** * Gets the parameters for the execution * * @return Parameters */ public Params getParams() { Params ps = this.params != null ? new Params(this.params) : new Params(); if (this.defaultGraphURIs != null) { for (String defaultGraph : this.defaultGraphURIs) { ps.addParam(HttpParams.pUsingGraph, defaultGraph); } } if (this.namedGraphURIs != null) { for (String namedGraph : this.namedGraphURIs) { ps.addParam(HttpParams.pUsingNamedGraph, namedGraph); } } return ps; }
protected static Params getServiceParams(String serviceURI, Context context) throws QueryExecException { Params params = new Params(); @SuppressWarnings("unchecked") Map<String, Map<String, List<String>>> serviceParams = (Map<String, Map<String, List<String>>>) context .get(ARQ.serviceParams); if (serviceParams != null) { Map<String, List<String>> paramsMap = serviceParams.get(serviceURI); if (paramsMap != null) { for (String param : paramsMap.keySet()) { if (HttpParams.pQuery.equals(param)) throw new QueryExecException("ARQ serviceParams overrides the 'query' SPARQL protocol parameter"); List<String> values = paramsMap.get(param); for (String value : values) params.addParam(param, value); } } } return params; }
super(new Params(PRIORITY).requireNetwork()); presenter.getPresenterComponent().inject(this); this.username = username;
@Override public void execute() { // Validation if (this.getEndpoint() == null) throw new ARQException("Null endpoint for remote update by form"); if (this.getUpdateRequest() == null) throw new ARQException("Null update request for remote update"); // Execution String reqStr = this.getUpdateRequest().toString(); Params ps = new Params(this.getParams()); ps.addParam(HttpParams.pUpdate, reqStr); execHttpPostForm(this.getEndpoint(), ps, null, HttpResponseLib.nullResponse, getClient(), getHttpContext()); } }