本文整理汇总了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);
}