当前位置: 首页>>代码示例>>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;未经允许,请勿转载。