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

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


    {
        StringBuffer result = new StringBuffer();

        Serializable argument;
        Serializable[] arguments = message.getArguments();
        Formatter formatter;

        if(arguments == null || arguments.length == 0)
        {
            return "";
        }

        for(int i = 0; i < arguments.length; i++)
        {
            if(i == 0)
            {
                result.append(" (");
            }
            else
            {
                result.append(",");
            }

            argument = arguments[i];
            formatter = this.messageContext.config().getFormatterFactory().findFormatter(argument.getClass());

            if (formatter != null && !isDefaultFormatter(formatter.getClass()))
            {
                //noinspection unchecked
                result.append(formatter.format(this.messageContext, argument));
            }
            else if(argument instanceof Localizable)
            {
                result.append(((Localizable)argument).toString(this.messageContext));
            }
            else
            {
                //use default formatter (if available)
                if(formatter != null)
                {
                    //noinspection unchecked
                    result.append(formatter.format(this.messageContext, argument));
                }
                else
                {
                    result.append(argument.toString());
                }
View Full Code Here


            if (this.formatterCache == null)
            {
                this.formatterCache = new ConcurrentHashMap<Class<?>, Formatter>();
            }

            Formatter found = findFormatterFor(type);

            if (found == null)
            {
                getLogger().info("default formatter used for: " + type.getName());
                found = FormatterBuilder.createFormatter(type);
            }

            if(found.isStateless())
            {
                this.formatterCache.put(type, found);
            }
            return found;
        }
View Full Code Here

    {
        StringBuffer result = new StringBuffer();

        Serializable argument;
        Serializable[] arguments = message.getArguments();
        Formatter formatter;

        if(arguments == null || arguments.length == 0)
        {
            return "";
        }

        for(int i = 0; i < arguments.length; i++)
        {
            if(i == 0)
            {
                result.append(" (");
            }
            else
            {
                result.append(",");
            }

            argument = arguments[i];
            formatter = this.messageContext.config().getFormatterFactory().findFormatter(argument.getClass());

            if (formatter != null && !isDefaultFormatter(formatter.getClass()))
            {
                //noinspection unchecked
                result.append(formatter.format(this.messageContext, argument));
            }
            else if(argument instanceof Localizable)
            {
                result.append(((Localizable)argument).toString(this.messageContext));
            }
            else
            {
                //use default formatter (if available)
                if(formatter != null)
                {
                    //noinspection unchecked
                    result.append(formatter.format(this.messageContext, argument));
                }
                else
                {
                    result.append(argument.toString());
                }
View Full Code Here

            if (this.formatterCache == null)
            {
                this.formatterCache = new ConcurrentHashMap<Class<?>, Formatter>();
            }

            Formatter found = findFormatterFor(type);

            if (found == null)
            {
                getLogger().info("default formatter used for: " + type.getName());
                found = FormatterBuilder.createFormatter(type);
            }

            if(found.isStateless())
            {
                this.formatterCache.put(type, found);
            }
            return found;
        }
View Full Code Here

            return value;
        }

        if (messageContext.config().getFormatterFactory() != null)
        {
            Formatter formatter = messageContext.config().getFormatterFactory().findFormatter(value.getClass());
            if (formatter != null)
            {
                return formatter.format(messageContext, value);
            }
        }

        if (value instanceof Localizable)
        {
View Full Code Here

    {
        StringBuffer result = new StringBuffer();

        Serializable argument;
        Serializable[] arguments = message.getArguments();
        Formatter formatter;

        if(arguments == null || arguments.length == 0)
        {
            return "";
        }

        for(int i = 0; i < arguments.length; i++)
        {
            if(i == 0)
            {
                result.append(" (");
            }
            else
            {
                result.append(",");
            }

            argument = arguments[i];
            formatter = this.messageContext.config().getFormatterFactory().findFormatter(argument.getClass());

            if (formatter != null && !isDefaultFormatter(formatter.getClass()))
            {
                //noinspection unchecked
                result.append(formatter.format(this.messageContext, argument));
            }
            else if(argument instanceof Localizable)
            {
                result.append(((Localizable)argument).toString(this.messageContext));
            }
            else
            {
                //use default formatter (if available)
                if(formatter != null)
                {
                    //noinspection unchecked
                    result.append(formatter.format(this.messageContext, argument));
                }
                else
                {
                    result.append(argument.toString());
                }
View Full Code Here

            if (this.formatterCache == null)
            {
                this.formatterCache = new ConcurrentHashMap<Class<?>, Formatter>();
            }

            Formatter found = findFormatterFor(type);

            if (found == null)
            {
                getLogger().info("default formatter used for: " + type.getName());
                found = FormatterBuilder.createFormatter(type);
            }

            if(found.isStateless())
            {
                this.formatterCache.put(type, found);
            }
            return found;
        }
View Full Code Here

            return value;
        }

        if (messageContext.config().getFormatterFactory() != null)
        {
            Formatter formatter = messageContext.config().getFormatterFactory().findFormatter(value.getClass());
            if (formatter != null)
            {
                return formatter.format(messageContext, value);
            }
        }

        if (value instanceof Localizable)
        {
View Full Code Here

    {
        StringBuffer result = new StringBuffer();

        Serializable argument;
        Serializable[] arguments = message.getArguments();
        Formatter formatter;

        if(arguments == null || arguments.length == 0)
        {
            return "";
        }

        for(int i = 0; i < arguments.length; i++)
        {
            if(i == 0)
            {
                result.append(" (");
            }
            else
            {
                result.append(",");
            }

            argument = arguments[i];
            formatter = this.messageContext.config().getFormatterFactory().findFormatter(argument.getClass());

            if (formatter != null && !isDefaultFormatter(formatter.getClass()))
            {
                //noinspection unchecked
                result.append(formatter.format(this.messageContext, argument));
            }
            else if(argument instanceof Localizable)
            {
                result.append(((Localizable)argument).toString(this.messageContext));
            }
            else
            {
                //use default formatter (if available)
                if(formatter != null)
                {
                    //noinspection unchecked
                    result.append(formatter.format(this.messageContext, argument));
                }
                else
                {
                    result.append(argument.toString());
                }
View Full Code Here

            if (this.formatterCache == null)
            {
                this.formatterCache = new ConcurrentHashMap<Class<?>, Formatter>();
            }

            Formatter found = findFormatterFor(type);

            if (found == null)
            {
                if(LOGGER.isLoggable(Level.INFO))
                {
                    LOGGER.info("default formatter used for: " + type.getName());
                }
                found = FormatterBuilder.createFormatter(type);
            }

            if(found.isStateless())
            {
                this.formatterCache.put(type, found);
            }
            return found;
        }
View Full Code Here

TOP

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

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.