Package org.apache.tapestry.ioc

Examples of org.apache.tapestry.ioc.MessageFormatter


    }

    @Test
    public void formatters_are_cached()
    {
        MessageFormatter mf1 = _messages.getFormatter("result");
        MessageFormatter mf2 = _messages.getFormatter("result");

        assertSame(mf2, mf1);
    }
View Full Code Here


        }

        Object coercedConstraintValue = coerceConstraintValue(finalConstraintValue, validator
                .getConstraintType());

        MessageFormatter formatter = findMessageFormatter(
                overrideId,
                overrideMessages,
                locale,
                validatorType,
                validator);
View Full Code Here

        return String.format("[[missing key: %s]]", key);
    }

    public MessageFormatter getFormatter(final String key)
    {
        MessageFormatter result = _barrier.withRead(new Invokable<MessageFormatter>()
        {
            public MessageFormatter invoke()
            {
                return _cache.get(key);
            }
        });

        if (result != null) return result;

        final MessageFormatter newFormatter = buildMessageFormatter(key);

        _barrier.withWrite(new Runnable()
        {
            public void run()
            {
View Full Code Here

    }
   
    @Test
    public void get_formatter()
    {
        MessageFormatter mf = _messages.getFormatter("result");

        assertEquals(mf.format("great"), "The result is 'great'.");
    }
View Full Code Here

    }

    @Test
    public void formatters_are_cached()
    {
        MessageFormatter mf1 = _messages.getFormatter("result");
        // Throw in a case-insensitive check:
        MessageFormatter mf2 = _messages.getFormatter("Result");

        assertSame(mf2, mf1);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.ioc.MessageFormatter

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.