本文整理匯總了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);
}
}
示例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;
}
}
示例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);
}
示例4: forComponent
import org.apache.deltaspike.jsf.api.message.JsfMessage; //導入依賴的package包/類
@Override
public JsfMessage<T> forComponent(UIComponent uiComponent)
{
return forClientId(uiComponent.getClientId());
}
示例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);
}