Package org.apache.myfaces.extensions.cdi.message.api

Examples of org.apache.myfaces.extensions.cdi.message.api.Message


    /**
     * {@inheritDoc}
     */
    public Message add()
    {
        Message result = create();
        this.messageContext.addMessage(this.messageContext, result);
        return result;
    }
View Full Code Here


        if (this.messageDescriptor == null)
        {
            throw new IllegalStateException("messageDescriptor is missing");
        }

        Message result = createNewMessage();

        if(result instanceof MessageContextConfigAware && this.messageContext != null)
        {
            ((MessageContextConfigAware)result).setMessageContextConfig(this.messageContext.config());
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Message create()
    {
        Message result = buildMessage();
        reset();
        return result;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public String toText()
    {
        Message baseMessage = buildMessage();

        return getMessageText(baseMessage);
    }
View Full Code Here

     * Creates the message for the current state.
     * @return message for the current state
     */
    public Message getToMessage()
    {
        Message message = this.messageContext.message().text(this.messageKey).create();

        for(Serializable argument : this.numberedArgument)
        {
            message.addArgument(argument);
        }

        for(Map.Entry<String, Serializable> entry : this.namedArgument.entrySet())
        {
            message.addArgument(new SimpleNamedArgument(entry.getKey(), entry.getValue()));
        }
        return message;
    }
View Full Code Here

     * Creates the message and returns the text of it.
     * @return text of the message
     */
    public String getToText()
    {
        Message message = getToMessage();

        return message.toString(this.messageContext);
    }
View Full Code Here

        this.messageContext.config().change().messageInterpolator(new ELAwareMessageInterpolator(new TestELProvider()));

        Number arg1 = new BigDecimal("123.4567");
        Date arg2 = new Date();
        String text = "#1: {arg1} and #2: {arg2}";
        Message message1 = this.messageContext.message().text(text)
                .namedArgument("arg1", arg1).namedArgument("arg2", arg2).create();

        Message message2 = new DefaultMessage(text)
                .addArgument(NamedArguments.add("arg1", arg1).add("arg2", arg2).create());
        ((MessageContextConfigAware)message2).setMessageContextConfig(this.messageContext.config());

        assertEquals(message1, message2);
        assertEquals(message1.toString(), message2.toString());
        assertEquals(message1.toString(this.messageContext), message2.toString(this.messageContext));
    }
View Full Code Here

        this.messageContext.config().change().messageInterpolator(new ELAwareMessageInterpolator(new TestELProvider()));

        Number arg1 = new BigDecimal("123.4567");
        Date arg2 = new Date();
        String text = "#1: {arg1} and #2: {arg2}";
        Message message1 = this.messageContext.message().text(text)
                .namedArgument("arg1", arg1).namedArgument("arg2", arg2).create();

        Map<String, Serializable> arguments = new HashMap<String, Serializable>();
        arguments.put("arg1", arg1);
        arguments.put("arg2", arg2);
        Message message2 = new DefaultMessage(text).addArgument(NamedArguments.convert(arguments));
        ((MessageContextConfigAware)message2).setMessageContextConfig(this.messageContext.config());

        assertEquals(message1, message2);
        assertEquals(message1.toString(), message2.toString());
        assertEquals(message1.toString(this.messageContext), message2.toString(this.messageContext));
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Message add()
    {
        Message result = create();
        this.messageContext.addMessage(this.messageContext, result);
        return result;
    }
View Full Code Here

        if (this.messageDescriptor == null)
        {
            throw new IllegalStateException("messageDescriptor is missing");
        }

        Message result = createNewMessage();

        if(result instanceof MessageContextConfigAware && this.messageContext != null)
        {
            ((MessageContextConfigAware)result).setMessageContextConfig(this.messageContext.config());
        }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.cdi.message.api.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.