當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。