本文整理匯總了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);
}
}