Package com.dotcms.repackage.org.apache.commons.lang.text

Examples of com.dotcms.repackage.org.apache.commons.lang.text.StrBuilder


            if (args == 0)
            {
                return method.getName();
            }

            StrBuilder methodKey = new StrBuilder((args+1)*16).append(method.getName());

            for (int j = 0; j < args; j++)
            {
                /*
                 * If the argument type is primitive then we want
                 * to convert our primitive type signature to the
                 * corresponding Object type so introspection for
                 * methods with primitive types will work correctly.
                 *
                 * The lookup map (convertPrimitives) contains all eight
                 * primitives (boolean, byte, char, double, float, int, long, short)
                 * known to Java. So it should never return null for the key passed in.
                 */
                if (parameterTypes[j].isPrimitive())
                {
                    methodKey.append((String) convertPrimitives.get(parameterTypes[j]));
                }
                else
                {
                    methodKey.append(parameterTypes[j].getName());
                }
            }

            return methodKey.toString();
        }
View Full Code Here


            if (args == 0)
            {
                return method;
            }

            StrBuilder methodKey = new StrBuilder((args+1)*16).append(method);

            for (int j = 0; j < args; j++)
            {
                Object arg = params[j];
                if (arg == null)
                {
                    methodKey.append(NULL_ARG);
                }
                else
                {
                    methodKey.append(arg.getClass().getName());
                }
            }

            return methodKey.toString();
        }
View Full Code Here

     * definition, and the current template being rendered if that is
     * different.
     */
    protected String id(InternalContextAdapter context)
    {
        StrBuilder str = new StrBuilder(100)
            .append("block $").append(key);
        if (!context.getCurrentTemplateName().equals(getTemplateName()))
        {
            str.append(" used in ").append(context.getCurrentTemplateName());
        }
        return str.toString();
    }
View Full Code Here

     */
    private String getLiteral()
    {
        if (literal == null)
        {
            StrBuilder buffer = new StrBuilder();
           
            for(Token t : node.getTokens()) {
                buffer.append(t.image);
            }
           
            literal = buffer.toString();
        }
        return literal;
    }
View Full Code Here

            Logger.error(this,msg);
            throw new VelocityException(msg);
        }

        /* now just create the VM call, and use evaluate */
        StrBuilder template = new StrBuilder("#");
        template.append(vmName);
        template.append("(");
        for( int i = 0; i < params.length; i++)
        {
            template.append(" $");
            template.append(params[i]);
        }
        template.append(" )");

        return evaluate(context, writer, logTag, template.toString());
    }
View Full Code Here

    {
        Object [] params = new Object [] { arg };

        try
        {
            StrBuilder sb = new StrBuilder("set");
            sb.append(property);

            setMethod(introspector.getMethod(clazz, sb.toString(), params));

            if (!isAlive())
            {
                /*
                 *  now the convenience, flip the 1st character
                 */

                char c = sb.charAt(3);

                if (Character.isLowerCase(c))
                {
                    sb.setCharAt(3, Character.toUpperCase(c));
                }
                else
                {
                    sb.setCharAt(3, Character.toLowerCase(c));
                }

                setMethod(introspector.getMethod(clazz, sb.toString(), params));
            }
        }
        /**
         * pass through application level runtime exceptions
         */
 
View Full Code Here

     * @param t the Token
     * @return StrBuilder with the special tokens.
     */
    public static StrBuilder getSpecialText(Token t)
    {
        StrBuilder sb = new StrBuilder();

        Token tmp_t = t.specialToken;

        while (tmp_t.specialToken != null)
        {
            tmp_t = tmp_t.specialToken;
        }

        while (tmp_t != null)
        {
            String st = tmp_t.image;

            for(int i = 0, is = st.length(); i < is; i++)
            {
                char c = st.charAt(i);

                if ( c == '#' || c == '$' )
                {
                    sb.append( c );
                }

                /*
                 *  more dreaded MORE hack :)
                 *
                 *  looking for ("\\")*"$" sequences
                 */

                if ( c == '\\')
                {
                    boolean ok = true;
                    boolean term = false;

                    int j = i;
                    for( ok = true; ok && j < is; j++)
                    {
                        char cc = st.charAt( j );

                        if (cc == '\\')
                        {
                            /*
                             *  if we see a \, keep going
                             */
                            continue;
                        }
                        else if( cc == '$' )
                        {
                            /*
                             *  a $ ends it correctly
                             */
                            term = true;
                            ok = false;
                        }
                        else
                        {
                            /*
                             *  nah...
                             */
                            ok = false;
                        }
                    }

                    if (term)
                    {
                        String foo =  st.substring( i, j );
                        sb.append( foo );
                        i = j;
                    }
                }
            }

View Full Code Here

        {
            return t.image;
        }
        else
        {
            StrBuilder special = getSpecialText(t);
            if (special.length() > 0)
            {
                return special.append(t.image).toString();
            }
            return t.image;
        }
    }
View Full Code Here

    {
        // if there's nothing to replace, skip this (saves buffer allocation)
        if( argStr.indexOf('$') == -1 )
            return argStr;
       
        StrBuilder argBuf = new StrBuilder();

        for (int cIdx = 0, is = argStr.length(); cIdx < is;)
        {
            char ch = argStr.charAt(cIdx);
           
            if( ch == '$' )
            {
                StrBuilder nameBuf = new StrBuilder();
                for (++cIdx ; cIdx < is; ++cIdx)
                {
                    ch = argStr.charAt(cIdx);
                    if (ch == '_' || ch == '-'
                        || Character.isLetterOrDigit(ch))
                        nameBuf.append(ch);
                    else if (ch == '{' || ch == '}')
                        continue;
                    else
                        break;
                }

                if (nameBuf.length() > 0)
                {
                    Object value = vars.get(nameBuf.toString());

                    if (value == null)
                        argBuf.append("$").append(nameBuf.toString());
                    else
                        argBuf.append(value.toString());
                }
               
            }
View Full Code Here

        if (tokens.size()==1)
        {
            return NodeUtils.tokenLiteral(tokens.get(0));
        }

        StrBuilder sb = new StrBuilder();
        for(Token t : tokens) {
            sb.append(NodeUtils.tokenLiteral(t));
        }
       
        return sb.toString();
    }
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.apache.commons.lang.text.StrBuilder

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.