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


Java JsfMessage类代码示例

本文整理汇总了Java中org.apache.deltaspike.jsf.api.message.JsfMessage的典型用法代码示例。如果您正苦于以下问题:Java JsfMessage类的具体用法?Java JsfMessage怎么用?Java JsfMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JsfMessage类属于org.apache.deltaspike.jsf.api.message包,在下文中一共展示了JsfMessage类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createJsfMessage

import org.apache.deltaspike.jsf.api.message.JsfMessage; //导入依赖的package包/类
@Produces
@Dependent
public <M> JsfMessage<M> createJsfMessage(InjectionPoint injectionPoint,
                                   MessageBundleInvocationHandler invocationHandler)
{
    if (!(injectionPoint.getType() instanceof ParameterizedType))
    {
        throw new IllegalArgumentException("JsfMessage must be used as generic type");
    }
    ParameterizedType paramType = (ParameterizedType) injectionPoint.getType();
    Type[] actualTypes = paramType.getActualTypeArguments();
    if (actualTypes.length != 1)
    {
        throw new IllegalArgumentException("JsfMessage must have the MessageBundle as generic type parameter");
    }
    try
    {
        @SuppressWarnings("unchecked")
        Class<M> type = (Class<M>) actualTypes[0];
        return createJsfMessageFor(injectionPoint, type, invocationHandler);
    }
    catch (ClassCastException e)
    {
        throw new IllegalArgumentException("Incorrect class found when trying to convert to parameterized type",e);
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:27,代码来源:JsfMessageProducer.java

示例2: invoke

import org.apache.deltaspike.jsf.api.message.JsfMessage; //导入依赖的package包/类
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable
{
    Object message = invocationHandler.invoke(proxy, method, args);

    if (severity == null)
    {
        if (message instanceof Message)
        {
            return message;
        }

        return getMessageCategory(message, JsfMessage.CATEGORY_SUMMARY);
    }
    else
    {
        String summary = getMessageCategory(message, JsfMessage.CATEGORY_SUMMARY);
        String detail = getMessageCategory(message, JsfMessage.CATEGORY_DETAIL);

        FacesContext.getCurrentInstance().addMessage(clientId, new FacesMessage(severity, summary, detail));

        return message;
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:24,代码来源:JsfMessageBundleInvocationHandler.java

示例3: forClientId

import org.apache.deltaspike.jsf.api.message.JsfMessage; //导入依赖的package包/类
@Override
public JsfMessage<T> forClientId(String clientId)
{
    return new DefaultJsfMessage<T>(type, clientId, invocationHandler);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:6,代码来源:DefaultJsfMessage.java

示例4: forComponent

import org.apache.deltaspike.jsf.api.message.JsfMessage; //导入依赖的package包/类
@Override
public JsfMessage<T> forComponent(UIComponent uiComponent)
{
    return forClientId(uiComponent.getClientId());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:6,代码来源:DefaultJsfMessage.java

示例5: createJsfMessageFor

import org.apache.deltaspike.jsf.api.message.JsfMessage; //导入依赖的package包/类
private <M> JsfMessage<M> createJsfMessageFor(InjectionPoint injectionPoint, Class<M> rawType,
                                              MessageBundleInvocationHandler invocationHandler)
{
    // X TODO check if the JsfMessage should get injected into a UIComponent and use #getClientId()
    return new DefaultJsfMessage<M>(rawType, null, invocationHandler);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:7,代码来源:JsfMessageProducer.java


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