@Override public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) { return configuration.getDataSourceFactory(); } });
@Override public Map<String, Map<String, String>> getViewConfiguration(HelloWorldConfiguration configuration) { return configuration.getViewRendererConfiguration(); } });
public static void main(String[] args) throws Exception { new HelloWorldApplication().run(args); }
@Override public void run(HelloWorldConfiguration configuration, Environment environment) { final PersonDAO dao = new PersonDAO(hibernateBundle.getSessionFactory()); final Template template = configuration.buildTemplate(); environment.healthChecks().register("template", new TemplateHealthCheck(template)); environment.admin().addTask(new EchoTask()); environment.jersey().register(DateRequiredFeature.class); environment.jersey().register(new AuthDynamicFeature(new BasicCredentialAuthFilter.Builder<User>() .setAuthenticator(new ExampleAuthenticator()) .setAuthorizer(new ExampleAuthorizer()) .setRealm("SUPER SECRET STUFF") .buildAuthFilter())); environment.jersey().register(new AuthValueFactoryProvider.Binder<>(User.class)); environment.jersey().register(RolesAllowedDynamicFeature.class); environment.jersey().register(new HelloWorldResource(template)); environment.jersey().register(new ViewResource()); environment.jersey().register(new ProtectedResource()); environment.jersey().register(new PeopleResource(dao)); environment.jersey().register(new PersonResource(dao)); environment.jersey().register(new FilteredResource()); } }
@Override protected void run(Bootstrap<HelloWorldConfiguration> bootstrap, Namespace namespace, HelloWorldConfiguration configuration) throws Exception { final Template template = configuration.buildTemplate(); if (namespace.getBoolean("include-default")) { LOGGER.info("DEFAULT => {}", template.render(Optional.empty())); } for (String name : namespace.<String>getList("names")) { for (int i = 0; i < 1000; i++) { LOGGER.info("{} => {}", name, template.render(Optional.of(name))); Thread.sleep(1000); } } } }
@Override public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) { bootstrap.addBundle( new ConsulBundle<HelloWorldConfiguration>(getName()) { @Override public ConsulFactory getConsulFactory(HelloWorldConfiguration configuration) { return configuration.getConsulFactory(); } }); }
package com.example.helloworld; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public class MyTest { public static void main(String[] args) throws JSONException { String str = "{'league': 'Champions League','season': '2015/16','start': '2015-11-01','end': '2016-03-31','teams': [ \r\n { 'name': 'Spain' },\r\n { 'name': 'Germany'},\r\n { 'name': 'Italy' },\r\n { 'name': 'Brasil' },\r\n { 'name': 'Argentina' }\r\n]}"; System.out.println(getCountyList(str).toString()); } public static List<String> getCountyList(String json) throws JSONException { List<String> list = new ArrayList<String>(); JSONObject jsonObject = new JSONObject(json); JSONArray teamList = (JSONArray) jsonObject.get("teams"); for (int i = 0, len = teamList.length(); i < len; i++) { JSONObject team = (JSONObject) teamList.get(i); list.add((String) team.get("name")); } return list; } }
@Override public ZipkinFactory getZipkinFactory(HelloWorldConfiguration configuration) { return configuration.getZipkinFactory(); } });
@Override public ConsulFactory getConsulFactory(HelloWorldConfiguration configuration) { return configuration.getConsulFactory(); } });
setContentView(R.layout.activity_hello_world); Card card = new Card(this); card.setText("Hello world!"); card.setFootnote("androidzeitgeist.com");
@Override public GraphQLFactory getGraphQLFactory(HelloWorldConfiguration configuration) { final GraphQLFactory factory = configuration.getGraphQLFactory(); // the RuntimeWiring must be configured prior to the run() // methods being called so the schema is connected properly. factory.setRuntimeWiring(buildWiring(configuration)); return factory; } };
public static void main(String[] args) throws Exception { new HelloWorldApplication().run(args); }
@Override public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) { return configuration.getDataSourceFactory(); } };
@Override public Map<String, Map<String, String>> getViewConfiguration(HelloWorldConfiguration configuration) { return configuration.getViewRendererConfiguration(); } });
@Override public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) { bootstrap.addBundle( new ZipkinBundle<HelloWorldConfiguration>(getName()) { @Override public ZipkinFactory getZipkinFactory(HelloWorldConfiguration configuration) { return configuration.getZipkinFactory(); } }); }
public static void main(String[] args) throws Exception { new HelloWorldApplication().run(args); }
@Override public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) { return configuration.getDataSourceFactory(); } };
public static void main(String[] args) throws Exception { new HelloWorldApplication().run(args); }
@Override public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) { return configuration.getDataSourceFactory(); } });
public static void main(String[] args) throws Exception { new HelloWorldApplication().run(args); }