Package org.apache.commons.lang3.text

Examples of org.apache.commons.lang3.text.StrBuilder

The aim has been to provide an API that mimics very closely what StringBuffer provides, but with additional methods. It should be noted that some edge cases, with invalid indices or null input, have been altered - see individual methods. The biggest of these changes is that by default, null will not output the text 'null'. This can be controlled by a property, {@link #setNullText(String)}.

Prior to 3.0, this class implemented Cloneable but did not implement the clone method so could not be used. From 3.0 onwards it no longer implements the interface. @since 2.2 @version $Id: StrBuilder.java 1153484 2011-08-03 13:39:42Z ggregory $


    @Before
    public void setUp() {
        StaticContainer.reset();
        publicChild = new PublicChild();
        publiclyShadowedChild = new PubliclyShadowedChild();
        privatelyShadowedChild = new PrivatelyShadowedChild();
    }
View Full Code Here


    @Before
    public void setUp() {
        StaticContainer.reset();
        publicChild = new PublicChild();
        publiclyShadowedChild = new PubliclyShadowedChild();
        privatelyShadowedChild = new PrivatelyShadowedChild();
    }
View Full Code Here

        assertTrue(StringUtils.startsWithAny("abcxyz", "abc"));
        assertTrue(StringUtils.startsWithAny("abcxyz", null, "xyz", "abc"));
        assertFalse(StringUtils.startsWithAny("abcxyz", null, "xyz", "abcd"));

        assertTrue("StringUtils.startsWithAny(abcxyz, StringBuilder(xyz), StringBuffer(abc))", StringUtils.startsWithAny("abcxyz", new StringBuilder("xyz"), new StringBuffer("abc")));
        assertTrue("StringUtils.startsWithAny( StrBuilder(abcxyz), StringBuilder(xyz), StringBuffer(abc))", StringUtils.startsWithAny( new StrBuilder("abcxyz"), new StringBuilder("xyz"), new StringBuffer("abc")));
    }
View Full Code Here

        assertTrue("StringUtils.endsWithAny(abcxyz, new String[] {xyz})", StringUtils.endsWithAny("abcxyz", new String[] {"xyz"}));
        assertTrue("StringUtils.endsWithAny(abcxyz, new String[] {null, xyz, abc})", StringUtils.endsWithAny("abcxyz", new String[] {null, "xyz", "abc"}));
        assertFalse("StringUtils.endsWithAny(defg, new String[] {null, xyz, abc})", StringUtils.endsWithAny("defg", new String[] {null, "xyz", "abc"}));

        assertTrue("StringUtils.endsWithAny(abcxyz, StringBuilder(abc), StringBuffer(xyz))", StringUtils.endsWithAny("abcxyz", new StringBuilder("abc"), new StringBuffer("xyz")));
        assertTrue("StringUtils.endsWithAny( StrBuilder(abcxyz), StringBuilder(abc), StringBuffer(xyz))", StringUtils.endsWithAny( new StrBuilder("abcxyz"), new StringBuilder("abc"), new StringBuffer("xyz")));
    }
View Full Code Here

    @Test
    public void testIdentityToStringStrBuilder() {
        final Integer i = Integer.valueOf(102);
        final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));

        final StrBuilder builder = new StrBuilder();
        ObjectUtils.identityToString(builder, i);
        assertEquals(expected, builder.toString());

        try {
            ObjectUtils.identityToString((StrBuilder)null, "tmp");
            fail("NullPointerException expected");
        } catch(final NullPointerException npe) {
        }
       
        try {
            ObjectUtils.identityToString(new StrBuilder(), null);
            fail("NullPointerException expected");
        } catch(final NullPointerException npe) {
        }
    }
View Full Code Here

     * @param l The list of columns.
     * @return A comma separated string of the query strings of the given columns.
     */
    /* package */
    static String columnListToQueryString(List<AbstractColumn> l) {
        StrBuilder builder = new StrBuilder();
        List<String> stringList = Lists.newArrayList();
        for(AbstractColumn col : l) {
            stringList.add(col.toQueryString());
        }
        builder.appendWithSeparators(stringList, ", ");
        return builder.toString();
    }
View Full Code Here

            clauses.add("FORMAT " + userFormatOptions.toQueryString());
        }
        if(hasOptions()) {
            clauses.add("OPTIONS " + options.toQueryString());
        }
        StrBuilder result = new StrBuilder();
        result.appendWithSeparators(clauses, " ");
        return result.toString();
    }
View Full Code Here

     * The string returned does not contain the FORMAT keyword.
     *
     * @return The query string.
     */
    public String toQueryString() {
        StrBuilder builder = new StrBuilder();
        List<String> stringList = Lists.newArrayList();
        for(AbstractColumn col : columnPatterns.keySet()) {
            String pattern = columnPatterns.get(col);
            stringList.add(col.toQueryString() + " " + Query.stringToQueryStringLiteral(pattern));
        }
        builder.appendWithSeparators(stringList, ", ");
        return builder.toString();
    }
View Full Code Here

     */
    private String createIdPivotPrefix() {
        if(!isPivot()) {
            return "";
        }
        return new StrBuilder().appendWithSeparators(values, PIVOT_COLUMNS_SEPARATOR)
                .append(PIVOT_AGGREGATION_SEPARATOR).toString();
    }
View Full Code Here

     */
    private String createLabelPivotPart() {
        if(!isPivot()) {
            return "";
        }
        return new StrBuilder().appendWithSeparators(values, PIVOT_COLUMNS_SEPARATOR).toString();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.lang3.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.