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 $


    return true;
  }

  @Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();

    boolean present_start = true && (isSetStart());
    builder.append(present_start);
    if (present_start)
      builder.append(start);

    boolean present_finish = true && (isSetFinish());
    builder.append(present_finish);
    if (present_finish)
      builder.append(finish);

    return builder.toHashCode();
  }
View Full Code Here


    return true;
  }

  @Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();

    boolean present_key = true && (isSetKey());
    builder.append(present_key);
    if (present_key)
      builder.append(key);

    boolean present_column_parent = true && (isSetColumn_parent());
    builder.append(present_column_parent);
    if (present_column_parent)
      builder.append(column_parent);

    boolean present_column_slices = true && (isSetColumn_slices());
    builder.append(present_column_slices);
    if (present_column_slices)
      builder.append(column_slices);

    boolean present_reversed = true && (isSetReversed());
    builder.append(present_reversed);
    if (present_reversed)
      builder.append(reversed);

    boolean present_count = true && (isSetCount());
    builder.append(present_count);
    if (present_count)
      builder.append(count);

    boolean present_consistency_level = true && (isSetConsistency_level());
    builder.append(present_consistency_level);
    if (present_consistency_level)
      builder.append(consistency_level.getValue());

    return builder.toHashCode();
  }
View Full Code Here

    }
  }

  @Override
  public String toString() {
    final ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
    if (ArrayUtils.isNotEmpty(configurationClasses)) {
      final String[] names = new String[configurationClasses.length];
      for (int i = 0; i < names.length; i++) {
        names[i] = configurationClasses[i].getName();
      }
      sb.append("configurationClasses", Arrays.toString(names));
    }
    if (ArrayUtils.isNotEmpty(configurationPackages)) {
      final String[] names = new String[configurationPackages.length];
      for (int i = 0; i < names.length; i++) {
        names[i] = configurationPackages[i].getName();
      }
      sb.append("configurationPackages", Arrays.toString(names));
    }

    if (!CollectionUtils.isEmpty(jvmSystemProperties)) {
      final StringWriter sw = new StringWriter(256);
      try {
        jvmSystemProperties.store(sw, "JVM System Propperties");
      } catch (final IOException e) {
        throw new RuntimeException(e);
      }
      sb.append("jvmSystemProperties", sw.toString());
    }
    return sb.toString();
  }
View Full Code Here

  public Purchaser() {
  }

  public String toString() {
    return new ToStringBuilder(this)
        .append("id", id)
        .append("name", name)
        .append("address", address)
        .append("nip", nip)
        .toString();
View Full Code Here

     * @return a string for this object
     */
    @Override
    public String toString()
    {
        ToStringBuilder sb = new ToStringBuilder(this);
        if (isAttributeResult())
        {
            sb.append("parentNode", getNode()).append("attribute",
                    getAttributeName());
        }
        else
        {
            sb.append("resultNode", getNode());
        }
        return sb.toString();
    }
View Full Code Here

     * @return a string for this object
     */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this).append("keys", nodeKeys).toString();
    }
View Full Code Here

     * @return a string for this object
     */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this)
                .append("propertyDelimiter", getPropertyDelimiter())
                .append("escapedDelimiter", getEscapedDelimiter())
                .append("indexStart", getIndexStart())
                .append("indexEnd", getIndexEnd())
                .append("attributeStart", getAttributeStart())
View Full Code Here

     * @return a string for this object
     */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this).append("fileName", getFileName())
                .append("basePath", getBasePath())
                .append("sourceURL", sourceURLAsString())
                .append("encoding", getEncoding())
                .append("fileSystem", getFileSystem())
                .append("locationStrategy", getLocationStrategy()).toString();
View Full Code Here

    }

    @Override
    public String toString()
    {
        return new ToStringBuilder(this)
            .append("cfId", cfId)
            .append("ksName", ksName)
            .append("cfName", cfName)
            .append("cfType", cfType)
            .append("comparator", comparator)
View Full Code Here

        assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString());
        assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString());
    }

    public void testPerson() {
        Person p = new Person();
        p.name = "John Doe";
        p.age = 33;
        p.smoker = false;
        String pBaseStr = p.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(p));
        assertEquals(pBaseStr + "[name=John Doe,age=33,smoker=false]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).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.