本文整理汇总了Java中org.lastaflute.core.message.UserMessages.toPropertySet方法的典型用法代码示例。如果您正苦于以下问题:Java UserMessages.toPropertySet方法的具体用法?Java UserMessages.toPropertySet怎么用?Java UserMessages.toPropertySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lastaflute.core.message.UserMessages
的用法示例。
在下文中一共展示了UserMessages.toPropertySet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupItemMessages
import org.lastaflute.core.message.UserMessages; //导入方法依赖的package包/类
protected void setupItemMessages(ExceptionMessageBuilder br, UserMessages messages) {
br.addItem("Messages");
final Set<String> propertySet = messages.toPropertySet();
for (String property : propertySet) {
br.addElement(property);
for (Iterator<UserMessage> ite = messages.accessByIteratorOf(property); ite.hasNext();) {
br.addElement(" " + ite.next());
}
}
}
示例2: toApplicationMessageList
import org.lastaflute.core.message.UserMessages; //导入方法依赖的package包/类
protected List<LaApplicationMessage> toApplicationMessageList(UserMessages messages) {
final List<LaApplicationMessage> convertedList = new ArrayList<LaApplicationMessage>(messages.size());
for (String property : messages.toPropertySet()) {
for (Iterator<UserMessage> ite = messages.accessByIteratorOf(property); ite.hasNext();) {
final UserMessage message = ite.next();
verifyResourceMessage(messages, message);
convertedList.add(toApplicationMessage(property, message));
}
}
return convertedList;
}
示例3: test_toUserMessages
import org.lastaflute.core.message.UserMessages; //导入方法依赖的package包/类
public void test_toUserMessages() throws Exception {
// ## Arrange ##
ActionValidator<UserMessages> validator = createValidator();
MockForm form = new MockForm();
Set<ConstraintViolation<Object>> vioSet = new HashSet<ConstraintViolation<Object>>();
vioSet.add(createViolation("sea"));
vioSet.add(createViolation("land.oneman"));
vioSet.add(createViolation("land.minio"));
vioSet.add(createViolation("piari"));
vioSet.add(createViolation("piari[0].dstore"));
vioSet.add(createViolation("piari[2].dstore"));
vioSet.add(createViolation("piari[2].plaza"));
vioSet.add(createViolation("piari[3].plaza"));
vioSet.add(createViolation("piari[5].dstore"));
// ## Act ##
UserMessages messages = validator.toUserMessages(form, vioSet);
// ## Assert ##
Set<String> propertySet = messages.toPropertySet();
assertHasAnyElement(propertySet);
log(propertySet);
assertEquals(vioSet.size(), propertySet.size());
List<UserMessage> messageList = new ArrayList<UserMessage>();
for (String property : propertySet) {
for (Iterator<UserMessage> iterator = messages.accessByIteratorOf(property); iterator.hasNext();) {
messageList.add(iterator.next());
}
}
for (UserMessage message : messageList) {
log(message);
}
}