当前位置: 首页>>代码示例>>Java>>正文


Java Result.include方法代码示例

本文整理汇总了Java中br.com.caelum.vraptor.Result.include方法的典型用法代码示例。如果您正苦于以下问题:Java Result.include方法的具体用法?Java Result.include怎么用?Java Result.include使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在br.com.caelum.vraptor.Result的用法示例。


在下文中一共展示了Result.include方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filterForumListing

import br.com.caelum.vraptor.Result; //导入方法依赖的package包/类
/**
 * Filter the property bag for forums/show, based on group interaction
 * settings
 *
 * @param propertyBag the property bag for the "show" method of the {@link ForumController} action
 * @param userSession the user session of the current logged user
 */
public void filterForumListing(Result result, UserSession userSession) {
	@SuppressWarnings("unchecked")
	Collection<UserSession> sessions = (Collection<UserSession>) result.included().get("onlineUsers");

	if (sessions == null) {
		sessions = new ArrayList<UserSession>();
	}

	Set<UserSession> newSessions = new HashSet<UserSession>();
	User currentUser = userSession.getUser();

	for (Group group : currentUser.getGroups()) {
		for (UserSession anotherUserSession : sessions) {
			User user = anotherUserSession.getUser();

			if (user != null && user.getGroups().contains(group)) {
				newSessions.add(anotherUserSession);
			}
		}
	}

	result.include("totalLoggedUsers", newSessions.size());
	result.include("onlineUsers", newSessions);
}
 
开发者ID:eclipse123,项目名称:JForum,代码行数:32,代码来源:GroupInteractionFilter.java

示例2: verify

import br.com.caelum.vraptor.Result; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Post("/asjkdjnjsaknfknsdklglas")
public void verify(Result r){
	List<User> users = session.createCriteria(User.class).list();
	List<User> invalid = new ArrayList<>();
	for (User user : users) {
		if (!isValid(user)) {
			invalid.add(user);
		}
	}
	r.include("invalid", invalid);
}
 
开发者ID:caelum,项目名称:mamute,代码行数:13,代码来源:VerifyUsersController.java

示例3: outject

import br.com.caelum.vraptor.Result; //导入方法依赖的package包/类
public void outject(@Observes MethodExecuted event, Result result, MethodInfo methodInfo) {

		Type returnType = event.getMethodReturnType();

		if (!returnType.equals(Void.TYPE)) {
			String name = extractor.nameFor(returnType);
			Object value = methodInfo.getResult();
			logger.debug("outjecting {}={}", name, value);
			result.include(name, value);
		}
	}
 
开发者ID:caelum,项目名称:vraptor4,代码行数:12,代码来源:OutjectResult.java


注:本文中的br.com.caelum.vraptor.Result.include方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。