public ToStringBuilder(
     Object paramObject, ToStringStyle paramToStringStyle, StringBuffer paramStringBuffer) {
   ToStringStyle localToStringStyle = paramToStringStyle;
   if (paramToStringStyle == null) {
     localToStringStyle = getDefaultStyle();
   }
   paramToStringStyle = paramStringBuffer;
   if (paramStringBuffer == null) {
     paramToStringStyle = new StringBuffer(512);
   }
   buffer = paramToStringStyle;
   style = localToStringStyle;
   object = paramObject;
   localToStringStyle.appendStart(paramToStringStyle, paramObject);
 }
 /**
  * Returns the built <code>toString</code>.
  *
  * <p>This method appends the end of data indicator, and can only be called once. Use {@link
  * #getStringBuffer} to get the current string state.
  *
  * <p>If the object is <code>null</code>, return the style's <code>nullText</code>
  *
  * @return the String <code>toString</code>
  */
 @Override
 public String toString() {
   if (this.getObject() == null) {
     this.getStringBuffer().append(this.getStyle().getNullText());
   } else {
     style.appendEnd(this.getStringBuffer(), this.getObject());
   }
   return this.getStringBuffer().toString();
 }
 public String toString() {
   if (getObject() == null) {
     getStringBuffer().append(getStyle().getNullText());
   }
   for (; ; ) {
     return getStringBuffer().toString();
     style.appendEnd(getStringBuffer(), getObject());
   }
 }
  /**
   * Constructs a builder for the specified object.
   *
   * <p>If the style is <code>null</code>, the default style is used.
   *
   * <p>If the buffer is <code>null</code>, a new one is created.
   *
   * @param object the Object to build a <code>toString</code> for, not recommended to be null
   * @param style the style of the <code>toString</code> to create, null uses the default style
   * @param buffer the <code>StringBuffer</code> to populate, may be null
   */
  public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
    if (style == null) {
      style = getDefaultStyle();
    }
    if (buffer == null) {
      buffer = new StringBuffer(512);
    }
    this.buffer = buffer;
    this.style = style;
    this.object = object;

    style.appendStart(buffer, object);
  }
 /**
  * Append to the <code>toString</code> an <code>Object</code> array.
  *
  * <p>A boolean parameter controls the level of detail to show. Setting <code>true</code> will
  * output the array in full. Setting <code>false</code> will output a summary, typically the size
  * of the array.
  *
  * @param fieldName the field name
  * @param array the array to add to the <code>toString</code>
  * @param fullDetail <code>true</code> for detail, <code>false</code> for summary info
  * @return this
  */
 public ToStringBuilder append(
     final String fieldName, final Object[] array, final boolean fullDetail) {
   style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
   return this;
 }
Esempio n. 6
0
 public void setUseFieldNames(boolean useFieldNames) {
   super.setUseFieldNames(useFieldNames);
 }
 /**
  * Append the <code>toString</code> from another object.
  *
  * <p>This method is useful where a class delegates most of the implementation of its properties
  * to another class. You can then call <code>toString()</code> on the other class and pass the
  * result into this method.
  *
  * <pre>
  *   private AnotherObject delegate;
  *   private String fieldInThisClass;
  *
  *   public String toString() {
  *     return new ToStringBuilder(this).
  *       appendToString(delegate.toString()).
  *       append(fieldInThisClass).
  *       toString();
  *   }</pre>
  *
  * <p>This method assumes that the other object uses the same <code>ToStringStyle</code> as this
  * one.
  *
  * <p>If the <code>toString</code> is <code>null</code>, no change is made.
  *
  * @param toString the result of <code>toString()</code> on another object
  * @return this
  * @since 2.0
  */
 public ToStringBuilder appendToString(String toString) {
   if (toString != null) {
     style.appendToString(buffer, toString);
   }
   return this;
 }
 /**
  * Append to the <code>toString</code> a <code>short</code> array.
  *
  * <p>A boolean parameter controls the level of detail to show. Setting <code>true</code> will
  * output the array in full. Setting <code>false</code> will output a summary, typically the size
  * of the array.
  *
  * @param fieldName the field name
  * @param array the array to add to the <code>toString</code>
  * @param fullDetail <code>true</code> for detail, <code>false</code> for summary info
  * @return this
  */
 public ToStringBuilder append(String fieldName, short[] array, boolean fullDetail) {
   style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
   return this;
 }
 /**
  * Append to the <code>toString</code> an <code>short</code> value.
  *
  * @param fieldName the field name
  * @param value the value to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(String fieldName, short value) {
   style.append(buffer, fieldName, value);
   return this;
 }
 /**
  * Append to the <code>toString</code> an <code>Object</code> value.
  *
  * @param fieldName the field name
  * @param obj the value to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(String fieldName, Object obj) {
   style.append(buffer, fieldName, obj, null);
   return this;
 }
 /**
  * Append to the <code>toString</code> a <code>short</code> value.
  *
  * @param value the value to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(short value) {
   style.append(buffer, null, value);
   return this;
 }
Esempio n. 12
0
 public void setContentEnd(String contentEnd) {
   super.setContentEnd(contentEnd);
 }
Esempio n. 13
0
 public void setContentStart(String contentStart) {
   super.setContentStart(contentStart);
 }
Esempio n. 14
0
 public void setArraySeparator(String arraySeparator) {
   super.setArraySeparator(arraySeparator);
 }
Esempio n. 15
0
 public void setArrayEnd(String arrayEnd) {
   super.setArrayEnd(arrayEnd);
 }
Esempio n. 16
0
 public void setArrayStart(String arrayStart) {
   super.setArrayStart(arrayStart);
 }
Esempio n. 17
0
 public void setArrayContentDetail(boolean arrayContentDetail) {
   super.setArrayContentDetail(arrayContentDetail);
 }
Esempio n. 18
0
 public void setDefaultFullDetail(boolean defaultFullDetail) {
   super.setDefaultFullDetail(defaultFullDetail);
 }
 /**
  * Append to the <code>toString</code> an <code>Object</code> value.
  *
  * @param obj the value to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(Object obj) {
   style.append(buffer, null, obj, null);
   return this;
 }
Esempio n. 20
0
 public void setUseClassName(boolean useClassName) {
   super.setUseClassName(useClassName);
 }
 /**
  * Append to the <code>toString</code> a <code>short</code> array.
  *
  * @param array the array to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(short[] array) {
   style.append(buffer, null, array, null);
   return this;
 }
Esempio n. 22
0
 public void setFieldNameValueSeparator(String fieldNameValueSeparator) {
   super.setFieldNameValueSeparator(fieldNameValueSeparator);
 }
 /**
  * Append to the <code>toString</code> an <code>Object</code> value.
  *
  * @param fieldName the field name
  * @param obj the value to add to the <code>toString</code>
  * @param fullDetail <code>true</code> for detail, <code>false</code> for summary info
  * @return this
  */
 public ToStringBuilder append(String fieldName, Object obj, boolean fullDetail) {
   style.append(buffer, fieldName, obj, Boolean.valueOf(fullDetail));
   return this;
 }
Esempio n. 24
0
 /**
  * Append to the <code>toString</code> a <code>long</code> value.
  *
  * @param value the value to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(final long value) {
   style.append(buffer, null, value);
   return this;
 }
 /**
  * Append to the <code>toString</code> a <code>short</code> array.
  *
  * @param fieldName the field name
  * @param array the array to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(String fieldName, short[] array) {
   style.append(buffer, fieldName, array, null);
   return this;
 }
Esempio n. 26
0
 /**
  * Append to the <code>toString</code> a <code>long</code> array.
  *
  * @param array the array to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(final long[] array) {
   style.append(buffer, null, array, null);
   return this;
 }
 /**
  * Append the <code>toString</code> from the superclass.
  *
  * <p>This method assumes that the superclass uses the same <code>ToStringStyle</code> as this
  * one.
  *
  * <p>If <code>superToString</code> is <code>null</code>, no change is made.
  *
  * @param superToString the result of <code>super.toString()</code>
  * @return this
  * @since 2.0
  */
 public ToStringBuilder appendSuper(String superToString) {
   if (superToString != null) {
     style.appendSuper(buffer, superToString);
   }
   return this;
 }
Esempio n. 28
0
 /**
  * Append to the <code>toString</code> an <code>Object</code> array.
  *
  * @param fieldName the field name
  * @param array the array to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(final String fieldName, final Object[] array) {
   style.append(buffer, fieldName, array, null);
   return this;
 }
Esempio n. 29
0
 /**
  * Append to the <code>toString</code> a <code>long</code> value.
  *
  * @param fieldName the field name
  * @param value the value to add to the <code>toString</code>
  * @return this
  */
 public ToStringBuilder append(final String fieldName, final long value) {
   style.append(buffer, fieldName, value);
   return this;
 }
Esempio n. 30
0
 public void setUseIdentityHashCode(boolean useIdentityHashCode) {
   super.setUseIdentityHashCode(useIdentityHashCode);
 }