Пример #1
0
 /** @see Object#toString() */
 public String toString() {
   return Objects.identityToString(this)
       .append("[modelId=")
       .append(StringUtils.quote(modelId))
       .append("]")
       .toString();
 }
Пример #2
0
  /**
   * Returns a string representation of the contents of the specified array. The string
   * representation consists of a list of the array's elements, enclosed in curly braces (<code>"{}"
   * </code>). Adjacent elements are separated by the characters <code>", "</code> (a comma followed
   * by a space). Returns <code>"null"</code> if <code>array</code> is <code>null</code>.
   *
   * @param array the array whose string representation to return.
   * @return a string representation of <code>array</code>.
   */
  public static String nullSafeToString(String[] array) {
    if (array == null) return NULL_ARRAY;

    int length = array.length;
    if (length == 0) return EMPTY_ARRAY;

    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < length; i++) {
      if (i == 0) buffer.append(ARRAY_START);
      else buffer.append(ARRAY_ELEMENT_SEPARATOR);

      buffer.append(StringUtils.quote(array[i]));
    }

    buffer.append(ARRAY_END);
    return buffer.toString();
  }