Java Code Examples for org.rapidoid.u.U#join()

The following examples show how to use org.rapidoid.u.U#join() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamicTest.java    From rapidoid with Apache License 2.0 6 votes vote down vote up
@Test
public void testDynamic() {
	Dynamic dynamic = (m, args) -> m.getName() + ":" + U.join(",", args);

	EgInterface dyn = Msc.dynamic(EgInterface.class, dynamic);
	EgInterface dyn2 = Msc.dynamic(EgInterface.class, dynamic);

	isTrue(dyn != dyn2);

	isTrue(dyn instanceof Proxy);
	isTrue(dyn2 instanceof Proxy);

	isTrue(dyn instanceof EgInterface);
	isTrue(dyn2 instanceof EgInterface);

	isTrue(dyn.toString().startsWith("EgInterface@"));
	isTrue(dyn2.toString().startsWith("EgInterface@"));

	neq(dyn.toString(), dyn2.toString());

	eq(dyn.hey(), "hey:");
	eq(dyn.abc(123, true), "abc:123,true");
	eq(dyn2.abc(4, false), "abc:4,false");
}
 
Example 2
Source File: AppDeployMojo.java    From rapidoid with Apache License 2.0 6 votes vote down vote up
private void initConfig() {
	Config config = new ConfigImpl("deploy");
	config.setPath(project.getBasedir().toString());

	Map<String, Object> cfg = config.toMap();

	if (U.isEmpty(token)) token = U.safe(U.str(cfg.get("token")));

	if (U.isEmpty(servers)) {
		Object srvrs = cfg.get("servers");

		if (srvrs instanceof String) {
			servers = (String) srvrs;

		} else if (srvrs instanceof List) {
			List list = (List) srvrs;
			servers = U.join(", ", list);
		}
	}
}
 
Example 3
Source File: ClsTest.java    From rapidoid with Apache License 2.0 5 votes vote down vote up
@Page
@GET
@DELETE
@SuppressWarnings("unchecked")
public String xyz(@Param("a") byte a, @Param("b") short b, @Param("c") char c, @Param("d") int d,
                  @Param("e") long e, @Param("f") float f, @Param("g") double g, @Param("h") boolean hh,
                  @Param("i") boolean ii, @Param("j") String j) {
	return U.join(":", a, b, c, d, e, f, g, hh, ii, j);
}
 
Example 4
Source File: RespImpl.java    From rapidoid with Apache License 2.0 5 votes vote down vote up
@Override
public Resp cookie(String name, String value, String... extras) {

	if (U.notEmpty(extras)) {
		value += "; " + U.join("; ", extras);
	}

	if (!cookieContainsPath(extras)) {
		value += "; path=" + HttpUtils.cookiePath();
	}

	cookies().put(name, value);

	return this;
}
 
Example 5
Source File: ReqImpl.java    From rapidoid with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	String info = verb() + " " + path();

	if (U.notEmpty(params)) {
		info += "?" + U.join("&", Msc.protectSensitiveInfo(params, "<...>").entrySet());
	}

	return info;
}
 
Example 6
Source File: MediaType.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
private String join(String name, String[] attributes) {
	String attrs = U.join("; ", (Object[]) attributes);

	return attrs.isEmpty() ? name : name + "; " + attrs;
}
 
Example 7
Source File: ConfigImpl.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
private String fullKey(String key, String separator) {
	return U.join(separator, Arr.concat(U.array(baseKeys), key));
}
 
Example 8
Source File: ConfigValueStore.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
@Override
public String desc() {
	return U.join(".", config.keys()) + "." + key;
}
 
Example 9
Source File: PageMenu.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return U.join("\n", items);
}
 
Example 10
Source File: WithContextTest.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
private String ctxInfo() {
	return U.join(":", Contextual.username(), Contextual.roles(), Contextual.isLoggedIn());
}
 
Example 11
Source File: IsolatedIntegrationTest.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
protected String appRoutes() {
	List<String> routes = Do.map(App.routes().all()).toList(Object::toString);
	Collections.sort(routes);
	return U.join("\n", routes);
}
 
Example 12
Source File: HttpTestCommons.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
protected String appRoutes() {
	return U.join("\n", App.routes().all());
}