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

The following examples show how to use org.rapidoid.u.U#arrayOf() . 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: MethodSecurityTest.java    From rapidoid with Apache License 2.0 6 votes vote down vote up
@BeforeEach
public void setup() {
	aa = Cls.getMethod(MyService.class, "aa");
	bb = Cls.getMethod(MyService.class, "bb");
	noAnn = Cls.getMethod(MyService.class, "noAnn");
	dd = Cls.getMethod(MyService.class, "dd");
	ee = Cls.getMethod(MyService.class, "ee");

	methods = U.arrayOf(Method.class, aa, bb, noAnn, dd, ee);

	aa2 = Cls.getMethod(MyService2.class, "aa");
	bb2 = Cls.getMethod(MyService2.class, "bb");
	noAnn2 = Cls.getMethod(MyService2.class, "noAnn");
	dd2 = Cls.getMethod(MyService2.class, "dd");
	ee2 = Cls.getMethod(MyService2.class, "ee");

	methods2 = U.arrayOf(Method.class, aa2, bb2, noAnn2, dd2, ee2);

	Env.setArgs("mode=production");
}
 
Example 2
Source File: Layout.java    From rapidoid with Apache License 2.0 6 votes vote down vote up
@Override
protected Object render() {
	List<Tag> rows = U.list();

	Tag row = GUI.row().class_("row row-separated");

	int n = 0;
	int colSize = 12 / cols;

	for (Object item : contents) {
		n++;
		if (n == cols + 1) {
			n = 1;
			rows.add(row);
			row = GUI.row().class_("row row-separated");
		}
		row = row.append(GUI.col_(colSize, item));
	}

	if (!row.isEmpty()) {
		rows.add(row);
	}

	return U.arrayOf(Tag.class, rows);
}
 
Example 3
Source File: DetailsHandler.java    From rapidoid with Apache License 2.0 6 votes vote down vote up
@Override
public Object call() {
	String[] targetProps;

	if (sorted) {
		List<String> props = U.list();

		for (Property prop : Models.item(target).properties(properties)) {
			props.add(prop.name());
		}

		Collections.sort(props);
		targetProps = U.arrayOf(String.class, props);

	} else {
		targetProps = properties;
	}

	return row(h1(title + ":"), show(target, targetProps));
}
 
Example 4
Source File: Defaults.java    From rapidoid with Apache License 2.0 5 votes vote down vote up
public static String[] staticFilesPath() {
	List<String> path = U.list(staticFilesPath);

	if (Env.isInitialized() && Env.dev()) {
		path.addAll(0, ClasspathUtil.getClasspathStaticFolders());
	}

	return U.arrayOf(path);
}
 
Example 5
Source File: HttpWrappers.java    From rapidoid with Apache License 2.0 5 votes vote down vote up
static HttpWrapper[] assembleWrappers(FastHttp http, RouteOptions options) {
	List<HttpWrapper> wrappers = U.list();

	wrappers.add(new HttpAuthWrapper(options.roles()));

	TransactionMode txMode = U.or(options.transaction(), TransactionMode.NONE);
	if (txMode != TransactionMode.NONE) {
		wrappers.add(new HttpTxWrapper(txMode));
	}

	Collections.addAll(wrappers, getConfiguredWrappers(http, options));

	return U.arrayOf(HttpWrapper.class, wrappers);
}
 
Example 6
Source File: UploadsParamRetriever.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
@Override
public Upload[] getParamValue(Req req) {
	List<Upload> uploads = req.files(name);
	return U.arrayOf(Upload.class, uploads);
}