當前位置: 首頁>>代碼示例>>Java>>正文


Java UserMessages.add方法代碼示例

本文整理匯總了Java中org.lastaflute.core.message.UserMessages.add方法的典型用法代碼示例。如果您正苦於以下問題:Java UserMessages.add方法的具體用法?Java UserMessages.add怎麽用?Java UserMessages.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.lastaflute.core.message.UserMessages的用法示例。


在下文中一共展示了UserMessages.add方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerActionMessage

import org.lastaflute.core.message.UserMessages; //導入方法依賴的package包/類
protected void registerActionMessage(UserMessages messages, ConstraintViolation<Object> vio) {
    final String propertyPath = extractPropertyPath(vio);
    final String plainMessage = filterMessageItem(extractMessage(vio), propertyPath);
    final String delimiter = MESSAGE_HINT_DELIMITER;
    final String messageItself;
    final String messageKey;
    if (plainMessage.contains(delimiter)) { // basically here
        messageItself = Srl.substringFirstRear(plainMessage, delimiter);
        messageKey = Srl.substringFirstFront(plainMessage, delimiter);
    } else { // just in case
        messageItself = plainMessage;
        messageKey = null;
    }
    final ConstraintDescriptor<?> descriptor = vio.getConstraintDescriptor();
    final Annotation annotation = descriptor.getAnnotation();
    final Set<Class<?>> groupSet = descriptor.getGroups();
    final Class<?>[] groups = groupSet.toArray(new Class<?>[groupSet.size()]);
    messages.add(propertyPath, createDirectMessage(messageItself, annotation, groups, messageKey));
}
 
開發者ID:lastaflute,項目名稱:lastaflute,代碼行數:20,代碼來源:ActionValidator.java

示例2: test_hasMessageOf

import org.lastaflute.core.message.UserMessages; //導入方法依賴的package包/類
public void test_hasMessageOf() throws Exception {
    // ## Arrange ##
    UserMessages messages = new UserMessages();
    assertFalse(messages.hasMessageOf("sea"));
    UserMessage message = new UserMessage("dockside", "over");
    assertFalse(messages.isAccessed());
    messages.add("sea", message);

    // ## Act ##
    // ## Assert ##
    assertTrue(messages.hasMessageOf("sea"));
    assertFalse(messages.hasMessageOf("land"));
    assertFalse(messages.isAccessed());
}
 
開發者ID:lastaflute,項目名稱:lastaflute,代碼行數:15,代碼來源:ActionMessagesTest.java

示例3: test_hasMessageOf_key

import org.lastaflute.core.message.UserMessages; //導入方法依賴的package包/類
public void test_hasMessageOf_key() throws Exception {
    // ## Arrange ##
    UserMessages messages = new UserMessages();
    assertFalse(messages.hasMessageOf("sea"));
    UserMessage message = new UserMessage("dockside", "over");
    assertFalse(messages.isAccessed());
    messages.add("sea", message);

    // ## Act ##
    // ## Assert ##
    assertTrue(messages.hasMessageOf("sea", "dockside"));
    assertFalse(messages.hasMessageOf("sea", "hangar"));
    assertFalse(messages.hasMessageOf("land", "dockside"));
    assertFalse(messages.isAccessed());
}
 
開發者ID:lastaflute,項目名稱:lastaflute,代碼行數:16,代碼來源:ActionMessagesTest.java

示例4: doAddMessages

import org.lastaflute.core.message.UserMessages; //導入方法依賴的package包/類
protected void doAddMessages(UserMessages messages) {
    final UserMessages existingOrCreated = get().orElseGet(() -> newUserMessages());
    existingOrCreated.add(messages);
    doSaveInfo(existingOrCreated);
}
 
開發者ID:lastaflute,項目名稱:lastaflute,代碼行數:6,代碼來源:ScopedMessageHandler.java

示例5: prepareUserMessages

import org.lastaflute.core.message.UserMessages; //導入方法依賴的package包/類
protected UserMessages prepareUserMessages(String property, String messageKey, Object[] args) {
    final UserMessages messages = newUserMessages();
    messages.add(property, new UserMessage(messageKey, args));
    return messages;
}
 
開發者ID:lastaflute,項目名稱:lastaflute,代碼行數:6,代碼來源:ScopedMessageHandler.java


注:本文中的org.lastaflute.core.message.UserMessages.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。